diff --git a/init_db.py b/init_db.py index 137a5a6..09ecf1b 100644 --- a/init_db.py +++ b/init_db.py @@ -17,6 +17,10 @@ cur.execute("INSERT INTO cards (category_id, content) VALUES (?,?)", cur.execute("INSERT INTO cards (category_id, content) VALUES (?,?)", (1, 'This is not an Atlas')) +cur.execute("INSERT INTO topics (content) VALUES (?)", ('mapping process',)) +cur.execute("INSERT INTO topics (content) VALUES (?)", ('Radical Neutrality',)) +cur.execute("INSERT INTO topics (content) VALUES (?)", ('Honeycomb documentation',)) +cur.execute("INSERT INTO topics (content) VALUES (?)", ('Metabolic Publishing',)) # close conenction connection.commit() diff --git a/library.db b/library.db index 1aab9d2..88aba05 100644 Binary files a/library.db and b/library.db differ diff --git a/schema.sql b/schema.sql index b87090d..abcf3b9 100644 --- a/schema.sql +++ b/schema.sql @@ -1,12 +1,12 @@ DROP TABLE IF EXISTS categories; -- is a list of categories(lists): type: reading_list, authors, notes, etc it's a type but type is also a keyword in python so better avoiding it DROP TABLE IF EXISTS cards; --the single entry of any category/type - +DROP TABLE IF EXISTS topics; -- test table weaved on measure for this test -- table creation CREATE TABLE categories ( id INTEGER PRIMARY KEY AUTOINCREMENT, created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, - title TEXT NOT NULL + title TEXT NOT NULL -- remember to not write the comma here at the end of each table ); CREATE TABLE cards ( @@ -15,4 +15,22 @@ CREATE TABLE cards ( created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, content TEXT NOT NULL, FOREIGN KEY (category_id) REFERENCES categories (id) -); \ No newline at end of file +); + +-- CREATE TABLE relations ( +-- id INTEGER PRIMARY KEY AUTOINCREMENT, + +-- ) +CREATE TABLE topics ( + id INTEGER PRIMARY KEY AUTOINCREMENT, + content TEXT NOT NULL +); + +-- join table cards-topic but will i need also topic-card?? having a table of relations would maybe be a better approach? and a table of actions? (like upload file) +CREATE TABLE topic_cards ( + id INTEGER NOT NULL, + topic_id INTEGER, + card_id INTEGER, + FOREIGN KEY (topic_id) REFERENCES topics(id) + FOREIGN KEY (card_id) REFERENCES cards(id) +) \ No newline at end of file