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