feat: schéma Drizzle/SQLite (machines, snapshots, executions)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-04 20:58:50 +02:00
parent feb136ffc1
commit 5aa4acdf87
7 changed files with 396 additions and 0 deletions
@@ -0,0 +1,38 @@
CREATE TABLE `executions` (
`id` text PRIMARY KEY NOT NULL,
`machine_id` text NOT NULL,
`action` text NOT NULL,
`mode` text DEFAULT 'manual' NOT NULL,
`started_at` text NOT NULL,
`finished_at` text,
`status` text NOT NULL,
`result_json` text,
`report_path` text,
`raw_log_path` text,
FOREIGN KEY (`machine_id`) REFERENCES `machines`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `machines` (
`id` text PRIMARY KEY NOT NULL,
`name` text NOT NULL,
`hostname` text NOT NULL,
`port` integer DEFAULT 22 NOT NULL,
`os_family` text DEFAULT 'unknown' NOT NULL,
`username` text NOT NULL,
`enc_password` text NOT NULL,
`enc_sudo_password` text,
`apt_proxy_mode` text DEFAULT 'direct' NOT NULL,
`apt_proxy_url` text,
`status` text DEFAULT 'unknown' NOT NULL,
`last_checked_at` text,
`created_at` text NOT NULL
);
--> statement-breakpoint
CREATE TABLE `snapshots` (
`id` text PRIMARY KEY NOT NULL,
`machine_id` text NOT NULL,
`checked_at` text NOT NULL,
`status` text NOT NULL,
`payload_json` text NOT NULL,
FOREIGN KEY (`machine_id`) REFERENCES `machines`(`id`) ON UPDATE no action ON DELETE cascade
);