feature: use dict for create table SQL statements
This commit is contained in:
parent
725adf65cc
commit
9f9b29898d
1 changed files with 8 additions and 1 deletions
|
@ -9,7 +9,7 @@ CREATE TABLE IF NOT EXISTS entries (
|
||||||
|
|
||||||
CREATE_TAGS_TABLE = """
|
CREATE_TAGS_TABLE = """
|
||||||
CREATE TABLE IF NOT EXISTS tags (
|
CREATE TABLE IF NOT EXISTS tags (
|
||||||
name TEXT PRIMARY KEY UNIQUE,
|
name TEXT PRIMARY KEY UNIQUE
|
||||||
)
|
)
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
@ -31,3 +31,10 @@ CREATE TABLE IF NOT EXISTS entries_tags (
|
||||||
FOREIGN KEY (tag_name) REFERENCES tags(name),
|
FOREIGN KEY (tag_name) REFERENCES tags(name),
|
||||||
PRIMARY KEY (entry_title, tag_name)
|
PRIMARY KEY (entry_title, tag_name)
|
||||||
)"""
|
)"""
|
||||||
|
|
||||||
|
tables = [
|
||||||
|
{"name": "entries", "create_statement": CREATE_ENTRIES_TABLE},
|
||||||
|
{"name": "tags", "create_statement": CREATE_TAGS_TABLE},
|
||||||
|
{"name": "backlinks", "create_statement": CREATE_BACKLINKS_TABLE},
|
||||||
|
{"name": "entries_tags", "create_statement": CREATE_ENTRIES_TAGS_TABLE},
|
||||||
|
]
|
||||||
|
|
Loading…
Add table
Reference in a new issue