CREATE TABLE `device_token` (
	`id` varchar(36) NOT NULL,
	`user_id` varchar(36) NOT NULL,
	`token` varchar(255) NOT NULL,
	`platform` enum('ios','android') NOT NULL,
	`last_seen_at` timestamp NOT NULL DEFAULT (now()),
	`created_at` timestamp NOT NULL DEFAULT (now()),
	CONSTRAINT `device_token_id` PRIMARY KEY(`id`),
	CONSTRAINT `device_token_token_uidx` UNIQUE(`token`)
);
--> statement-breakpoint
ALTER TABLE `device_token` ADD CONSTRAINT `device_token_user_id_user_id_fk` FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
CREATE INDEX `device_token_user_idx` ON `device_token` (`user_id`);