update search table sql to not allow duplicate anime names

This commit is contained in:
ksyasuda 2022-01-09 12:46:37 -08:00
parent 54cad7d62b
commit 9bd2b94bda

View File

@ -1,10 +1,9 @@
CREATE TABLE IF NOT EXISTS search_history ( CREATE TABLE search_history (
id integer PRIMARY KEY AUTOINCREMENT, id integer PRIMARY KEY AUTOINCREMENT,
anime_name varchar(200) NOT NULL, anime_name varchar(200) NOT NULL UNIQUE,
search_date DATETIME NOT NULL, search_date DATETIME NOT NULL,
CHECK (LENGTH(anime_name) > 0), CHECK (LENGTH(anime_name) > 0)
UNIQUE (anime_name, search_date)
); );
CREATE UNIQUE INDEX IF NOT EXISTS anime_search_idx ON search_history (anime_name, search_date); CREATE UNIQUE INDEX anime_search_idx ON search_history (anime_name, search_date);