CREATE TABLE `content_items` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `creator_id` integer NOT NULL, `title` text NOT NULL, `platform_content_id` text NOT NULL, `url` text NOT NULL, `content_type` text NOT NULL, `duration` integer, `file_path` text, `file_size` integer, `format` text, `quality_metadata` text, `status` text DEFAULT 'monitored' NOT NULL, `created_at` text DEFAULT (datetime('now')) NOT NULL, `updated_at` text DEFAULT (datetime('now')) NOT NULL, FOREIGN KEY (`creator_id`) REFERENCES `creators`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE TABLE `format_profiles` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `name` text NOT NULL, `video_resolution` text, `audio_codec` text, `audio_bitrate` text, `container_format` text, `is_default` integer DEFAULT false NOT NULL, `created_at` text DEFAULT (datetime('now')) NOT NULL, `updated_at` text DEFAULT (datetime('now')) NOT NULL ); --> statement-breakpoint CREATE TABLE `creators` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `name` text NOT NULL, `platform` text NOT NULL, `platform_id` text NOT NULL, `url` text NOT NULL, `monitoring_enabled` integer DEFAULT true NOT NULL, `check_interval` integer DEFAULT 360 NOT NULL, `image_url` text, `metadata` text, `created_at` text DEFAULT (datetime('now')) NOT NULL, `updated_at` text DEFAULT (datetime('now')) NOT NULL ); --> statement-breakpoint CREATE TABLE `download_history` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `content_item_id` integer, `creator_id` integer, `event_type` text NOT NULL, `status` text NOT NULL, `details` text, `created_at` text DEFAULT (datetime('now')) NOT NULL, FOREIGN KEY (`content_item_id`) REFERENCES `content_items`(`id`) ON UPDATE no action ON DELETE set null, FOREIGN KEY (`creator_id`) REFERENCES `creators`(`id`) ON UPDATE no action ON DELETE set null ); --> statement-breakpoint CREATE TABLE `notification_settings` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `type` text NOT NULL, `name` text NOT NULL, `enabled` integer DEFAULT true NOT NULL, `config` text NOT NULL, `on_grab` integer DEFAULT true NOT NULL, `on_download` integer DEFAULT true NOT NULL, `on_failure` integer DEFAULT true NOT NULL, `created_at` text DEFAULT (datetime('now')) NOT NULL, `updated_at` text DEFAULT (datetime('now')) NOT NULL ); --> statement-breakpoint CREATE TABLE `queue_items` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `content_item_id` integer NOT NULL, `status` text DEFAULT 'pending' NOT NULL, `priority` integer DEFAULT 0 NOT NULL, `attempts` integer DEFAULT 0 NOT NULL, `max_attempts` integer DEFAULT 3 NOT NULL, `error` text, `started_at` text, `completed_at` text, `created_at` text DEFAULT (datetime('now')) NOT NULL, `updated_at` text DEFAULT (datetime('now')) NOT NULL, FOREIGN KEY (`content_item_id`) REFERENCES `content_items`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE TABLE `system_config` ( `key` text PRIMARY KEY NOT NULL, `value` text NOT NULL, `created_at` text DEFAULT (datetime('now')) NOT NULL, `updated_at` text DEFAULT (datetime('now')) NOT NULL );