Enha: not null fields in db

This commit is contained in:
Grail Finder
2025-07-02 09:36:38 +03:00
parent 95a55a8213
commit 8bf719ae4c
3 changed files with 19 additions and 24 deletions

View File

@ -2,20 +2,17 @@
CREATE TABLE rooms (
id TEXT PRIMARY KEY,
created_at TIMESTAMP NOT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
creator_name TEXT NOT NULL,
team_turn TEXT NOT NULL DEFAULT '',
this_turn_limit INTEGER,
opened_this_turn INTEGER,
blue_counter INTEGER,
red_counter INTEGER,
red_turn BOOLEAN,
mime_done BOOLEAN,
is_public BOOLEAN,
is_running BOOLEAN,
language TEXT NOT NULL DEFAULT '',
round_time INTEGER,
is_over BOOLEAN,
this_turn_limit INTEGER NOT NULL DEFAULT 0,
opened_this_turn INTEGER NOT NULL DEFAULT 0,
blue_counter INTEGER NOT NULL DEFAULT 0,
red_counter INTEGER NOT NULL DEFAULT 0,
red_turn BOOLEAN NOT NULL DEFAULT FALSE,
mime_done BOOLEAN NOT NULL DEFAULT FALSE,
is_running BOOLEAN NOT NULL DEFAULT FALSE,
is_over BOOLEAN NOT NULL DEFAULT FALSE,
team_won TEXT NOT NULL DEFAULT '',
room_pass TEXT NOT NULL DEFAULT ''
);
@ -26,7 +23,7 @@ CREATE TABLE players (
username TEXT NOT NULL,
team TEXT NOT NULL DEFAULT '', -- 'red' or 'blue'
role TEXT NOT NULL DEFAULT '', -- 'guesser' or 'mime'
is_bot BOOLEAN DEFAULT FALSE,
is_bot BOOLEAN NOT NULL DEFAULT FALSE,
FOREIGN KEY (room_id) REFERENCES rooms(id)
);
@ -35,8 +32,8 @@ CREATE TABLE word_cards (
room_id TEXT NOT NULL,
word TEXT NOT NULL,
color TEXT NOT NULL DEFAULT '',
revealed BOOLEAN DEFAULT FALSE,
mime_view BOOLEAN DEFAULT FALSE,
revealed BOOLEAN NOT NULL DEFAULT FALSE,
mime_view BOOLEAN NOT NULL DEFAULT FALSE,
FOREIGN KEY (room_id) REFERENCES rooms(id)
);
@ -44,7 +41,7 @@ CREATE TABLE card_marks (
id INTEGER PRIMARY KEY AUTOINCREMENT,
card_id INTEGER NOT NULL,
username TEXT NOT NULL,
active BOOLEAN DEFAULT TRUE,
active BOOLEAN NOT NULL DEFAULT TRUE,
FOREIGN KEY (card_id) REFERENCES word_cards(id)
);
@ -57,7 +54,7 @@ CREATE TABLE actions (
word TEXT NOT NULL DEFAULT '',
word_color TEXT NOT NULL DEFAULT '',
number_associated TEXT NOT NULL DEFAULT '', -- for clues
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (room_id) REFERENCES rooms(id)
);
@ -67,6 +64,6 @@ CREATE TABLE settings (
language TEXT NOT NULL DEFAULT 'en',
room_pass TEXT NOT NULL DEFAULT '',
turn_time INTEGER NOT NULL DEFAULT 60, -- seconds
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (room_id) REFERENCES rooms(id)
);