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 -- remember to not write the comma here at the end of each table
);

CREATE TABLE cards (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    category_id INTEGER NOT NULL,
    created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
    content TEXT NOT NULL,
    FOREIGN KEY (category_id) REFERENCES categories (id)
);

-- 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)
)