You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
11 lines
570 B
11 lines
570 B
CREATE TABLE `favorites` (
|
|
`user_id` integer NOT NULL,
|
|
`card_id` integer NOT NULL,
|
|
`created_at` integer DEFAULT (cast((julianday('now') - 2440587.5)*86400000 as integer)) NOT NULL,
|
|
PRIMARY KEY(`user_id`, `card_id`),
|
|
FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
FOREIGN KEY (`card_id`) REFERENCES `cards`(`id`) ON UPDATE no action ON DELETE cascade
|
|
);
|
|
--> statement-breakpoint
|
|
CREATE INDEX `idx_favorite_user` ON `favorites` (`user_id`);--> statement-breakpoint
|
|
CREATE INDEX `idx_favorite_card` ON `favorites` (`card_id`);
|