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
);
