CREATE TABLE `user_export_tasks` (
  `id` integer PRIMARY KEY NOT NULL,
  `user_id` integer NOT NULL,
  `status` text DEFAULT 'queued' NOT NULL,
  `mask_policy` text DEFAULT 'masked' NOT NULL,
  `export_cutoff_at` integer,
  `output_dir` text,
  `output_name` text,
  `total_bytes` integer,
  `error_code` text,
  `error_message` text,
  `expires_at` integer,
  `created_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
  `updated_at` integer DEFAULT (unixepoch('subsec') * 1000) NOT NULL,
  FOREIGN KEY (`user_id`) REFERENCES `users`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE INDEX `user_export_tasks_user_id_idx` ON `user_export_tasks` (`user_id`);
--> statement-breakpoint
CREATE INDEX `user_export_tasks_status_idx` ON `user_export_tasks` (`status`);
