feat: create route to store FCM token

This commit is contained in:
2024-06-14 18:14:10 -04:00
parent 4d3c34579d
commit 231ed4bde4
16 changed files with 650 additions and 14 deletions

View File

@@ -0,0 +1,20 @@
-- 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
);