Initial upload

This commit is contained in:
antonn committed 2026-06-10 17:04:11 +00:00
1 parent b0bf3b7167
commit a022f29e34
65 files changed
+46484 -4339

No files matched your search

+59 -1
View File
@@ -2,8 +2,11 @@ CREATE TABLE IF NOT EXISTS users (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
email VARCHAR(255) NOT NULL,
password VARCHAR(255) NOT NULL,
secret VARCHAR(255) NOT NULL,
secret VARCHAR(255) NULL,
admin TINYINT(1) NOT NULL DEFAULT 0,
suspended TINYINT(1) NOT NULL DEFAULT 0,
suspended_at BIGINT UNSIGNED NULL,
suspended_by VARCHAR(255) NULL,
avatar_url VARCHAR(2048) NULL,
preferences JSON NULL,
recovery_codes TEXT NULL,
@@ -48,6 +51,9 @@ CREATE TABLE IF NOT EXISTS servers (
ip VARCHAR(255) NULL,
port INT NULL,
status VARCHAR(32) NULL,
suspended TINYINT(1) NOT NULL DEFAULT 0,
suspended_at BIGINT UNSIGNED NULL,
suspended_by VARCHAR(255) NULL,
runtime JSON NULL,
docker JSON NULL,
acl JSON NULL,
@@ -63,6 +69,23 @@ CREATE TABLE IF NOT EXISTS servers (
CONSTRAINT fk_servers_node FOREIGN KEY (node_id) REFERENCES nodes(id) ON DELETE SET NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS server_delete_jobs (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
server_name VARCHAR(120) NOT NULL,
technical_name VARCHAR(120) NOT NULL,
node_id VARCHAR(64) NOT NULL,
status ENUM('queued','running','completed','failed') NOT NULL DEFAULT 'queued',
attempts INT UNSIGNED NOT NULL DEFAULT 0,
next_attempt_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
last_error TEXT NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (id),
UNIQUE KEY uniq_server_delete_jobs_server (server_name),
KEY idx_server_delete_jobs_status_next (status, next_attempt_at),
KEY idx_server_delete_jobs_node (node_id)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS user_access (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
user_id BIGINT UNSIGNED NOT NULL,
@@ -72,6 +95,26 @@ CREATE TABLE IF NOT EXISTS user_access (
CONSTRAINT fk_user_access_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS destructive_action_grants (
grant_id CHAR(64) NOT NULL,
user_id BIGINT UNSIGNED NOT NULL,
email VARCHAR(255) NOT NULL,
session_hash CHAR(64) NOT NULL,
secret_hash CHAR(64) NOT NULL,
ip_hash CHAR(64) NOT NULL,
ua_hash CHAR(64) NOT NULL,
verified_at BIGINT UNSIGNED NOT NULL,
expires_at BIGINT UNSIGNED NOT NULL,
revoked_at BIGINT UNSIGNED NULL,
subject VARCHAR(190) NULL,
created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (grant_id),
KEY idx_destructive_grants_user_expires (user_id, expires_at),
KEY idx_destructive_grants_session (session_hash),
KEY idx_destructive_grants_expires (expires_at),
CONSTRAINT fk_destructive_grants_user FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
CREATE TABLE IF NOT EXISTS ai_chats (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
user_email VARCHAR(255) NOT NULL DEFAULT '',
@@ -187,3 +230,18 @@ CREATE TABLE IF NOT EXISTS subdomains (
KEY idx_subdomains_server (server_id),
CONSTRAINT fk_subdomains_server FOREIGN KEY (server_id) REFERENCES servers(id) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
-- Round-robin style panel monitoring history. One averaged row per minute,
-- pruned to a fixed retention window (default ~31 days) so the table stays at a
-- small, predictable size. bucket_ts is the UTC epoch (ms) truncated to the
-- minute, used as a stable upsert key.
CREATE TABLE IF NOT EXISTS panel_metrics (
bucket_ts BIGINT UNSIGNED NOT NULL,
cpu_percent DECIMAL(5,1) NOT NULL DEFAULT 0,
mem_percent DECIMAL(5,1) NOT NULL DEFAULT 0,
disk_percent DECIMAL(5,1) NOT NULL DEFAULT 0,
net_rx_bps BIGINT UNSIGNED NOT NULL DEFAULT 0,
net_tx_bps BIGINT UNSIGNED NOT NULL DEFAULT 0,
rps DECIMAL(8,1) NOT NULL DEFAULT 0,
PRIMARY KEY (bucket_ts)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;