Files
Termix/plugins/proxmox/migrations/mysql/0001_adopt_proxmox_stats.sql
T

27 lines
1.0 KiB
SQL

-- proxmox 0001: adopt_proxmox_stats
-- Generated by termix-plugin migrations. Review before committing.
CREATE TABLE IF NOT EXISTS `proxmox_node_history` (
`id` int AUTO_INCREMENT PRIMARY KEY,
`host_id` int NOT NULL,
`ts` text NOT NULL DEFAULT (CURRENT_TIMESTAMP),
`cpu_percent` double,
`mem_percent` double,
`disk_percent` double,
`net_rx_bytes` int,
`net_tx_bytes` int,
FOREIGN KEY (`host_id`) REFERENCES `ssh_data` (`id`) ON DELETE CASCADE
);
RENAME TABLE `proxmox_node_history` TO `p_proxmox_node_history`;
CREATE TABLE IF NOT EXISTS `proxmox_stats_preferences` (
`id` int AUTO_INCREMENT PRIMARY KEY,
`user_id` varchar(255) NOT NULL,
`host_id` int 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
);
RENAME TABLE `proxmox_stats_preferences` TO `p_proxmox_stats_preferences`;