Files
aniplay-api/drizzle/0003_puzzling_nightmare.sql

21 lines
626 B
SQL

-- Custom SQL migration file, put you code below! --
DROP TABLE `watch_status`;
--> statement-breakpoint
DROP TABLE `token`;
--> statement-breakpoint
CREATE TABLE `token` (
`device_id` text NOT NULL,
`token` text NOT NULL UNIQUE ON CONFLICT FAIL,
`username` text,
`last_connected_at` text DEFAULT (CURRENT_TIMESTAMP),
PRIMARY KEY(`device_id`) ON CONFLICT REPLACE
);
--> statement-breakpoint
CREATE TABLE `watch_status` (
`device_id` text NOT NULL,
`title_id` integer NOT NULL,
PRIMARY KEY(`device_id`, `title_id`),
FOREIGN KEY (`device_id`) REFERENCES `token`(`device_id`) ON UPDATE no action ON DELETE no action
);