-- proxmox 0001: adopt_proxmox_stats -- Generated by termix-plugin migrations. Review before committing. CREATE TABLE IF NOT EXISTS "proxmox_node_history" ( "id" serial PRIMARY KEY, "host_id" integer NOT NULL, "ts" text NOT NULL DEFAULT CURRENT_TIMESTAMP, "cpu_percent" double precision, "mem_percent" double precision, "disk_percent" double precision, "net_rx_bytes" integer, "net_tx_bytes" integer, FOREIGN KEY ("host_id") REFERENCES "ssh_data" ("id") ON DELETE CASCADE ); ALTER TABLE "proxmox_node_history" RENAME TO "p_proxmox_node_history"; CREATE TABLE IF NOT EXISTS "proxmox_stats_preferences" ( "id" serial PRIMARY KEY, "user_id" varchar(255) NOT NULL, "host_id" integer NOT NULL, "layout" text NOT NULL, "created_at" text NOT NULL DEFAULT CURRENT_TIMESTAMP, "updated_at" text NOT NULL DEFAULT CURRENT_TIMESTAMP, FOREIGN KEY ("user_id") REFERENCES "users" ("id") ON DELETE CASCADE, FOREIGN KEY ("host_id") REFERENCES "ssh_data" ("id") ON DELETE CASCADE ); CREATE UNIQUE INDEX IF NOT EXISTS "idx_proxmox_stats_prefs_user_host" ON "proxmox_stats_preferences" ("user_id", "host_id"); ALTER TABLE "proxmox_stats_preferences" RENAME TO "p_proxmox_stats_preferences";