Files

23 lines
1.1 KiB
SQL

ALTER TABLE ftp_accounts ADD COLUMN enabled BOOLEAN NOT NULL DEFAULT TRUE;
CREATE TABLE site_preferences (
site_id BIGINT UNSIGNED PRIMARY KEY,
website_json JSON NULL,
startup_cipher LONGBLOB NULL,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
CONSTRAINT fk_site_preferences FOREIGN KEY(site_id) REFERENCES sites(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE host_metrics (
project_id BIGINT UNSIGNED NOT NULL,
sampled_at DATETIME NOT NULL,
cpu_percent DOUBLE NOT NULL DEFAULT 0,
cpu_ticks BIGINT UNSIGNED NOT NULL DEFAULT 0,
memory_bytes BIGINT UNSIGNED NOT NULL DEFAULT 0,
process_count INT UNSIGNED NOT NULL DEFAULT 0,
storage_bytes BIGINT UNSIGNED NOT NULL DEFAULT 0,
database_bytes BIGINT UNSIGNED NOT NULL DEFAULT 0,
bandwidth_bytes BIGINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY(project_id,sampled_at),
INDEX idx_metric_retention(sampled_at),
CONSTRAINT fk_host_metric_project FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;