aniwrapper/sql/watch_history_tbl.sql

13 lines
410 B
MySQL
Raw Normal View History

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