CREATE TABLE `duplicati_backups` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `source_id` integer NOT NULL, `name` text NOT NULL, `last_report_at` text, `last_result` text, `last_begin` text, `last_end` text, `duration_seconds` integer, `examined_files` integer, `size_bytes` integer, `added_files` integer, `modified_files` integer, `deleted_files` integer, `warnings` integer DEFAULT 0 NOT NULL, `errors` integer DEFAULT 0 NOT NULL, `message` text, `last_success_at` text, `consecutive_failures` integer DEFAULT 0 NOT NULL, `expected_hours` integer DEFAULT 48 NOT NULL, `alert` integer DEFAULT true NOT NULL, `created_at` text DEFAULT (current_timestamp) NOT NULL, FOREIGN KEY (`source_id`) REFERENCES `duplicati_sources`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE UNIQUE INDEX `duplicati_backups_name_idx` ON `duplicati_backups` (`source_id`,`name`);--> statement-breakpoint CREATE TABLE `duplicati_runs` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `backup_id` integer NOT NULL, `at` text NOT NULL, `result` text NOT NULL, `duration_seconds` integer, `size_bytes` integer, `files_changed` integer, `warnings` integer DEFAULT 0 NOT NULL, `errors` integer DEFAULT 0 NOT NULL, FOREIGN KEY (`backup_id`) REFERENCES `duplicati_backups`(`id`) ON UPDATE no action ON DELETE cascade ); --> statement-breakpoint CREATE INDEX `duplicati_runs_idx` ON `duplicati_runs` (`backup_id`,`at`);--> statement-breakpoint CREATE TABLE `duplicati_sources` ( `id` integer PRIMARY KEY AUTOINCREMENT NOT NULL, `name` text NOT NULL, `token_hash` text NOT NULL, `token_prefix` text NOT NULL, `server_id` integer, `created_by` text, `created_at` text DEFAULT (current_timestamp) NOT NULL, `last_report_at` text ); --> statement-breakpoint CREATE UNIQUE INDEX `duplicati_sources_token_hash_unique` ON `duplicati_sources` (`token_hash`);