CREATE TABLE `change_log` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `at` text NOT NULL, `user_id` integer, `action` text NOT NULL, `entity` text NOT NULL, `entity_id` text, `detail` text, FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE set null ); --> statement-breakpoint CREATE INDEX `change_log_at_idx` ON `change_log` (`at`);--> statement-breakpoint CREATE TABLE `idea` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `title` text NOT NULL, `description` text DEFAULT '' NOT NULL, `status` text DEFAULT 'new' NOT NULL, `admin_note` text, `path` text, `app_version` text, `user_agent` text, `user_id` integer, `created_at` text NOT NULL, `updated_at` text NOT NULL, FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE set null ); --> statement-breakpoint CREATE INDEX `idea_status_idx` ON `idea` (`status`);--> statement-breakpoint CREATE TABLE `passkey` ( `id` text PRIMARY KEY NOT NULL, `user_id` integer NOT NULL, `name` text NOT NULL, `public_key` blob NOT NULL, `counter` integer DEFAULT 0 NOT NULL, `transports` text, `device_type` text, `backed_up` integer DEFAULT false NOT NULL, `created_at` text NOT NULL, `last_used_at` text, FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE INDEX `passkey_user_idx` ON `passkey` (`user_id`);--> statement-breakpoint CREATE TABLE `session` ( `id` text PRIMARY KEY NOT NULL, `user_id` integer NOT NULL, `kind` text DEFAULT 'browser' NOT NULL, `device_label` text NOT NULL, `user_agent` text, `ip` text, `created_at` text NOT NULL, `last_seen_at` text NOT NULL, `expires_at` text NOT NULL, FOREIGN KEY (`user_id`) REFERENCES `user`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE INDEX `session_user_idx` ON `session` (`user_id`);--> statement-breakpoint CREATE TABLE `setting` ( `key` text PRIMARY KEY NOT NULL, `value` text NOT NULL ); --> statement-breakpoint CREATE TABLE `user` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `username` text NOT NULL, `display_name` text NOT NULL, `password_hash` text NOT NULL, `access` text DEFAULT 'full' NOT NULL, `is_admin` integer DEFAULT false NOT NULL, `theme` text DEFAULT 'system' NOT NULL, `must_change_password` integer DEFAULT false NOT NULL, `created_at` text NOT NULL, `updated_at` text NOT NULL, `deleted_at` text ); --> statement-breakpoint CREATE UNIQUE INDEX `user_username_unique` ON `user` (`username`);