CREATE TABLE `collection_runs` ( `id` text PRIMARY KEY NOT NULL, `task_id` text NOT NULL, `distribution_id` text NOT NULL, `scheduled_date` text NOT NULL, `schedule_day` integer, `scheduled_at` text NOT NULL, `status` text DEFAULT 'pending' NOT NULL, `likes` integer, `comments` integer, `collects` integer, `status_description` text, `started_at` text, `completed_at` text, `created_at` text DEFAULT CURRENT_TIMESTAMP NOT NULL ); --> statement-breakpoint CREATE UNIQUE INDEX `collection_runs_distribution_date_idx` ON `collection_runs` (`distribution_id`,`scheduled_date`);--> statement-breakpoint CREATE INDEX `collection_runs_task_date_idx` ON `collection_runs` (`task_id`,`scheduled_date`);--> statement-breakpoint ALTER TABLE `distributions` ADD `latest_likes` integer;--> statement-breakpoint ALTER TABLE `distributions` ADD `latest_comments` integer;--> statement-breakpoint ALTER TABLE `distributions` ADD `latest_collects` integer;--> statement-breakpoint ALTER TABLE `distributions` ADD `collection_status` text DEFAULT 'pending' NOT NULL;--> statement-breakpoint ALTER TABLE `distributions` ADD `collection_status_description` text;--> statement-breakpoint ALTER TABLE `distributions` ADD `collection_updated_at` text;--> statement-breakpoint ALTER TABLE `distributions` ADD `last_collection_day` integer;--> statement-breakpoint ALTER TABLE `tasks` ADD `collection_start_date` text;--> statement-breakpoint ALTER TABLE `tasks` ADD `collection_days` text DEFAULT '[]' NOT NULL;--> statement-breakpoint ALTER TABLE `tasks` ADD `collection_schedule_updated_at` text;