adding sql schema for sqlite db, adding sqlite db to gitignore
This commit is contained in:
parent
63f27e8e13
commit
214a7ecff1
2 changed files with 31 additions and 1 deletions
2
.gitignore
vendored
2
.gitignore
vendored
|
|
@ -11,6 +11,6 @@ __pycache__/
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|
||||||
data-pipeline/kaikki-source-files/
|
data-pipeline/kaikki-source-files/
|
||||||
data-pipeline/db/pipeline.db
|
data-pipeline/db/staging.db
|
||||||
data-pipeline/.env
|
data-pipeline/.env
|
||||||
.aider*
|
.aider*
|
||||||
|
|
|
||||||
30
data-pipeline/db/schema.sql
Normal file
30
data-pipeline/db/schema.sql
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
CREATE TABLE words (
|
||||||
|
id TEXT PRIMARY KEY,
|
||||||
|
headword TEXT NOT NULL,
|
||||||
|
language_code TEXT NOT NULL,
|
||||||
|
pos TEXT NOT NULL,
|
||||||
|
created_at TEXT DEFAULT (datetime('now')),
|
||||||
|
UNIQUE(headword, language_code, pos)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE senses (
|
||||||
|
id TEXT PRIMARY KEY,
|
||||||
|
word_id TEXT NOT NULL REFERENCES words(id),
|
||||||
|
sense_index INTEGER NOT NULL DEFAULT 0,
|
||||||
|
difficulty TEXT NOT NULL,
|
||||||
|
definitions TEXT NOT NULL DEFAULT '[]',
|
||||||
|
examples TEXT NOT NULL DEFAULT '[]',
|
||||||
|
created_at TEXT DEFAULT (datetime('now')),
|
||||||
|
UNIQUE(word_id, sense_index)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE translations (
|
||||||
|
id TEXT PRIMARY KEY,
|
||||||
|
sense_id TEXT NOT NULL REFERENCES senses(id),
|
||||||
|
target_language_code TEXT NOT NULL,
|
||||||
|
translation TEXT NOT NULL,
|
||||||
|
gender TEXT,
|
||||||
|
difficulty TEXT NOT NULL,
|
||||||
|
created_at TEXT DEFAULT (datetime('now')),
|
||||||
|
UNIQUE(sense_id, target_language_code, translation)
|
||||||
|
);
|
||||||
Loading…
Add table
Add a link
Reference in a new issue