CREATE TABLE `notification_logs` (
	`id` varchar(128) PRIMARY KEY NOT NULL,
	`user_id` varchar(128) NOT NULL,
	`title` varchar(255) NOT NULL,
	`channel` varchar(32) NOT NULL,
	`status` varchar(16) NOT NULL,
	`message_id` varchar(255),
	`error` text,
	`sent_at` timestamp DEFAULT (now()) NOT NULL,
	CONSTRAINT `notification_logs_user_id_users_id_fk` FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON DELETE cascade ON UPDATE no action
);
CREATE INDEX `notification_logs_user_idx` ON `notification_logs`(`user_id`);
CREATE INDEX `notification_logs_channel_idx` ON `notification_logs`(`channel`);
CREATE INDEX `notification_logs_status_idx` ON `notification_logs`(`status`);
CREATE INDEX `notification_logs_sent_at_idx` ON `notification_logs`(`sent_at`);
