feat: socle BDD (tâche 1.9 Phase 1-2) + moteur APT (tâche 2 SJ-0→3) + WIP capabilities/auth/Rust
Checkpoint multi-chantiers (arbre vert : tsc 0 erreur, 70 tests, build OK). - tâche 1.9 Phase 1 : schéma socle (machine_state/events/reports/raw_artifacts/ hardware/metrics + colonnes étendues) + wiring refresh/execute. Migration 0002. - tâche 1.9 Phase 2 : machine_credentials + machine_host_keys (non destructif, dual-read + backfill). Migration 0003. Fix séquence journal de migration. - tâche 2 : SJ-0 (types étendus rétro-compatibles, réducteur Docker, resolveTemplate), SJ-1 (update-analyze enrichi), SJ-2 (apply + diff dpkg + timeout inactivité SSH), SJ-3 (reboot vérifié boot_id). - WIP parallèle inclus : /api/capabilities, auth/apiTokens/apiClients, system metrics, scaffold app_rust, ajustements frontend. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
CREATE TABLE `api_clients` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`name` text NOT NULL,
|
||||
`token_prefix` text NOT NULL,
|
||||
`token_hash` text NOT NULL,
|
||||
`scopes_json` text NOT NULL,
|
||||
`created_at` text NOT NULL,
|
||||
`last_used_at` text,
|
||||
`revoked_at` text
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE UNIQUE INDEX `api_clients_token_hash_unique` ON `api_clients` (`token_hash`);
|
||||
@@ -0,0 +1,150 @@
|
||||
CREATE TABLE `important_messages` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`machine_id` text,
|
||||
`source` text NOT NULL,
|
||||
`category` text NOT NULL,
|
||||
`severity` text NOT NULL,
|
||||
`package_name` text,
|
||||
`component` text,
|
||||
`message` text NOT NULL,
|
||||
`raw_line_ref` text,
|
||||
`snapshot_id` text,
|
||||
`execution_id` text,
|
||||
`first_seen_at` text NOT NULL,
|
||||
`last_seen_at` text NOT NULL,
|
||||
`acknowledged` integer DEFAULT 0 NOT NULL,
|
||||
`acknowledged_at` text,
|
||||
`acknowledged_by` text,
|
||||
`payload_json` text,
|
||||
FOREIGN KEY (`machine_id`) REFERENCES `machines`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `machine_events` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`machine_id` text,
|
||||
`event_type` text NOT NULL,
|
||||
`severity` text NOT NULL,
|
||||
`created_at` text NOT NULL,
|
||||
`actor_type` text,
|
||||
`actor_id` text,
|
||||
`snapshot_id` text,
|
||||
`execution_id` text,
|
||||
`job_id` text,
|
||||
`message` text,
|
||||
`payload_json` text,
|
||||
FOREIGN KEY (`machine_id`) REFERENCES `machines`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `machine_hardware` (
|
||||
`machine_id` text PRIMARY KEY NOT NULL,
|
||||
`probe_snapshot_id` text,
|
||||
`cpu_model` text,
|
||||
`cpu_cores` integer,
|
||||
`memory_bytes` integer,
|
||||
`gpus_json` text,
|
||||
`disks_json` text,
|
||||
`network_json` text,
|
||||
`firmware_json` text,
|
||||
`driver_json` text,
|
||||
`warnings_json` text,
|
||||
`updated_at` text NOT NULL,
|
||||
FOREIGN KEY (`machine_id`) REFERENCES `machines`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `machine_metrics_latest` (
|
||||
`machine_id` text PRIMARY KEY NOT NULL,
|
||||
`snapshot_id` text,
|
||||
`collected_at` text NOT NULL,
|
||||
`cpu_load1` real,
|
||||
`cpu_load5` real,
|
||||
`cpu_cores` integer,
|
||||
`memory_total_bytes` integer,
|
||||
`memory_used_bytes` integer,
|
||||
`memory_available_bytes` integer,
|
||||
`memory_used_percent` real,
|
||||
`filesystems_json` text,
|
||||
`root_used_percent` real,
|
||||
`warnings_json` text,
|
||||
FOREIGN KEY (`machine_id`) REFERENCES `machines`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `machine_state` (
|
||||
`machine_id` text PRIMARY KEY NOT NULL,
|
||||
`status` text NOT NULL,
|
||||
`apt_status` text,
|
||||
`apt_updates_count` integer DEFAULT 0 NOT NULL,
|
||||
`apt_reboot_required` integer DEFAULT 0 NOT NULL,
|
||||
`apt_last_analyze_at` text,
|
||||
`docker_status` text,
|
||||
`docker_installed` integer DEFAULT 0 NOT NULL,
|
||||
`docker_stacks_count` integer DEFAULT 0 NOT NULL,
|
||||
`docker_updates_count` integer DEFAULT 0 NOT NULL,
|
||||
`docker_prune_available` integer DEFAULT 0 NOT NULL,
|
||||
`post_install_status` text,
|
||||
`metrics_last_collected_at` text,
|
||||
`cpu_load1` real,
|
||||
`memory_used_percent` real,
|
||||
`root_used_percent` real,
|
||||
`disk_warnings_count` integer DEFAULT 0 NOT NULL,
|
||||
`hardware_warnings_count` integer DEFAULT 0 NOT NULL,
|
||||
`running_job_id` text,
|
||||
`last_error_kind` text,
|
||||
`last_error_message` text,
|
||||
`updated_at` text NOT NULL,
|
||||
FOREIGN KEY (`machine_id`) REFERENCES `machines`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `raw_artifacts` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`machine_id` text,
|
||||
`kind` text NOT NULL,
|
||||
`path` text NOT NULL,
|
||||
`bytes` integer,
|
||||
`sha256` text,
|
||||
`created_at` text NOT NULL,
|
||||
`expires_at` text,
|
||||
`pinned` integer DEFAULT 0 NOT NULL,
|
||||
`redacted` integer DEFAULT 1 NOT NULL,
|
||||
`retention_policy` text,
|
||||
`deleted_at` text,
|
||||
`delete_reason` text,
|
||||
`metadata_json` text,
|
||||
FOREIGN KEY (`machine_id`) REFERENCES `machines`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `reports` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`machine_id` text,
|
||||
`execution_id` text,
|
||||
`kind` text NOT NULL,
|
||||
`title` text NOT NULL,
|
||||
`path` text NOT NULL,
|
||||
`created_at` text NOT NULL,
|
||||
`pinned` integer DEFAULT 0 NOT NULL,
|
||||
`summary_json` text,
|
||||
FOREIGN KEY (`machine_id`) REFERENCES `machines`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
ALTER TABLE `executions` ADD `schema_version` integer DEFAULT 1 NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE `executions` ADD `request_id` text;--> statement-breakpoint
|
||||
ALTER TABLE `executions` ADD `job_id` text;--> statement-breakpoint
|
||||
ALTER TABLE `executions` ADD `important_json` text;--> statement-breakpoint
|
||||
ALTER TABLE `executions` ADD `report_id` text;--> statement-breakpoint
|
||||
ALTER TABLE `executions` ADD `exit_code` integer;--> statement-breakpoint
|
||||
ALTER TABLE `executions` ADD `error_kind` text;--> statement-breakpoint
|
||||
ALTER TABLE `executions` ADD `error_message` text;--> statement-breakpoint
|
||||
ALTER TABLE `machines` ADD `os_version` text;--> statement-breakpoint
|
||||
ALTER TABLE `machines` ADD `os_codename` text;--> statement-breakpoint
|
||||
ALTER TABLE `machines` ADD `arch` text;--> statement-breakpoint
|
||||
ALTER TABLE `machines` ADD `machine_kind` text;--> statement-breakpoint
|
||||
ALTER TABLE `machines` ADD `virtualization` text;--> statement-breakpoint
|
||||
ALTER TABLE `machines` ADD `hardware_profile` text;--> statement-breakpoint
|
||||
ALTER TABLE `machines` ADD `last_seen_at` text;--> statement-breakpoint
|
||||
ALTER TABLE `machines` ADD `updated_at` text;--> statement-breakpoint
|
||||
ALTER TABLE `machines` ADD `deleted_at` text;--> statement-breakpoint
|
||||
ALTER TABLE `snapshots` ADD `kind` text DEFAULT 'apt_update_analyze' NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE `snapshots` ADD `schema_version` integer DEFAULT 1 NOT NULL;--> statement-breakpoint
|
||||
ALTER TABLE `snapshots` ADD `important_json` text;--> statement-breakpoint
|
||||
ALTER TABLE `snapshots` ADD `raw_log_path` text;--> statement-breakpoint
|
||||
ALTER TABLE `snapshots` ADD `raw_artifact_id` text;--> statement-breakpoint
|
||||
ALTER TABLE `snapshots` ADD `source_job_id` text;
|
||||
@@ -0,0 +1,28 @@
|
||||
CREATE TABLE `machine_credentials` (
|
||||
`machine_id` text PRIMARY KEY NOT NULL,
|
||||
`auth_method` text NOT NULL,
|
||||
`enc_password` text,
|
||||
`enc_sudo_password` text,
|
||||
`enc_private_key` text,
|
||||
`enc_key_passphrase` text,
|
||||
`sudo_mode` text NOT NULL,
|
||||
`created_at` text NOT NULL,
|
||||
`updated_at` text NOT NULL,
|
||||
`last_test_at` text,
|
||||
`status` text,
|
||||
FOREIGN KEY (`machine_id`) REFERENCES `machines`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
--> statement-breakpoint
|
||||
CREATE TABLE `machine_host_keys` (
|
||||
`id` text PRIMARY KEY NOT NULL,
|
||||
`machine_id` text,
|
||||
`hostname` text NOT NULL,
|
||||
`port` integer NOT NULL,
|
||||
`key_type` text,
|
||||
`fingerprint_sha256` text NOT NULL,
|
||||
`public_key` text,
|
||||
`status` text NOT NULL,
|
||||
`first_seen_at` text NOT NULL,
|
||||
`last_seen_at` text NOT NULL,
|
||||
FOREIGN KEY (`machine_id`) REFERENCES `machines`(`id`) ON UPDATE no action ON DELETE cascade
|
||||
);
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -8,6 +8,27 @@
|
||||
"when": 1780599514478,
|
||||
"tag": "0000_brainy_dakota_north",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 1,
|
||||
"version": "6",
|
||||
"when": 1780669000000,
|
||||
"tag": "0001_api_clients",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 2,
|
||||
"version": "6",
|
||||
"when": 1780669100000,
|
||||
"tag": "0002_reflective_lifeguard",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 3,
|
||||
"version": "6",
|
||||
"when": 1780669200000,
|
||||
"tag": "0003_magical_psylocke",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user