add database model types and a few other db things

This commit is contained in:
Milim 2024-12-07 10:58:50 +01:00
parent 0e50b214ed
commit 28f571e02b
No known key found for this signature in database
5 changed files with 40 additions and 2 deletions

View file

@ -7,7 +7,7 @@ CREATE TABLE IF NOT EXISTS books(
book_id INTEGER PRIMARY KEY,
book_title TEXT NOT NULL,
book_description TEXT,
book_creation_date INTEGER NOT NULL,
book_creation_date TEXT NOT NULL,
author_id INTEGER NOT NULL,
FOREIGN KEY (author_id) REFERENCES users(user_id) ON DELETE CASCADE
@ -17,7 +17,7 @@ CREATE TABLE IF NOT EXISTS chapters(
chapter_id INTEGER PRIMARY KEY,
chapter_title TEXT NOT NULL,
chapter_text TEXT NOT NULL,
chapter_creation_date INT NOT NULL,
chapter_creation_date TEXT NOT NULL,
book_id INTEGER NOT NULL,
author_id INTEGER NOT NULL,
FOREIGN KEY (book_id) REFERENCES books(book_id) ON DELETE CASCADE,