CREATE TABLE `server_snapshots` (
	`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
	`server_id` integer NOT NULL,
	`polled_at` text NOT NULL,
	`status` text NOT NULL,
	`latency_ms` real,
	`ros_version` text,
	`board_name` text,
	`uptime` text,
	`cpu_load` integer,
	`free_memory` integer,
	`total_memory` integer,
	`identity_name` text,
	`raw_interfaces` text,
	`raw_ip_addresses` text,
	FOREIGN KEY (`server_id`) REFERENCES `servers`(`id`) ON UPDATE no action ON DELETE cascade
);
--> statement-breakpoint
CREATE TABLE `servers` (
	`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
	`name` text DEFAULT '' NOT NULL,
	`host` text NOT NULL,
	`port` integer DEFAULT 443 NOT NULL,
	`username` text DEFAULT 'admin' NOT NULL,
	`password` text DEFAULT '' NOT NULL,
	`use_ssl` integer DEFAULT true NOT NULL,
	`verify_ssl` integer DEFAULT false NOT NULL,
	`type` text DEFAULT 'home-router' NOT NULL,
	`site` text DEFAULT '' NOT NULL,
	`country` text DEFAULT '' NOT NULL,
	`asn` text DEFAULT '' NOT NULL,
	`comment` text DEFAULT '' NOT NULL,
	`enabled` integer DEFAULT true NOT NULL,
	`created_at` text DEFAULT (datetime('now')) NOT NULL,
	`updated_at` text DEFAULT (datetime('now')) NOT NULL
);
