2021-10-29 22:49:52 -07:00
|
|
|
CREATE TABLE watch_history (
|
2022-01-08 15:34:18 -08:00
|
|
|
id integer PRIMARY KEY AUTOINCREMENT,
|
|
|
|
anime_name varchar(200) NOT NULL,
|
|
|
|
episode_number integer NOT NULL,
|
2022-01-06 23:31:02 -08:00
|
|
|
watch_date DATETIME NOT NULL,
|
2022-01-08 15:34:18 -08:00
|
|
|
CHECK (LENGTH(anime_name) > 0),
|
|
|
|
CHECK (episode_number > 0),
|
|
|
|
UNIQUE (anime_name, episode_number, watch_date)
|
2021-10-29 22:49:52 -07:00
|
|
|
);
|
2022-01-06 23:31:02 -08:00
|
|
|
|
2022-01-08 15:34:18 -08:00
|
|
|
CREATE UNIQUE INDEX IF NOT EXISTS watch_anime_episode_idx ON watch_history (anime_name, episode_number);
|
2021-10-29 22:49:52 -07:00
|
|
|
|