You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
662 B
SQL

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
-- table creation
CREATE TABLE categories (
id INTEGER PRIMARY KEY AUTOINCREMENT,
created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
title TEXT NOT NULL
);
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)
);