44 lines
No EOL
1 KiB
SQL
44 lines
No EOL
1 KiB
SQL
-- Create the database if it doesn't exist
|
|
CREATE DATABASE IF NOT EXISTS prox;
|
|
USE prox;
|
|
|
|
-- Create servers table
|
|
CREATE TABLE IF NOT EXISTS servers (
|
|
id VARCHAR(36) PRIMARY KEY,
|
|
name VARCHAR(255) NOT NULL,
|
|
model VARCHAR(255) NOT NULL,
|
|
cpu_model VARCHAR(255) NOT NULL,
|
|
cpu_cores INT NOT NULL,
|
|
cpu_count INT NOT NULL,
|
|
ram_gb INT NOT NULL,
|
|
proxmox_url VARCHAR(255) NOT NULL,
|
|
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
|
|
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
INDEX idx_created_at (created_at),
|
|
INDEX idx_name (name)
|
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
|
|
|
|
|
|
-- Grant privileges to the application user
|
|
|
|
|
|
-- Add some sample data (optional)
|
|
INSERT INTO servers (
|
|
id,
|
|
name,
|
|
model,
|
|
cpu_model,
|
|
cpu_cores,
|
|
cpu_count,
|
|
ram_gb,
|
|
proxmox_url
|
|
) VALUES (
|
|
UUID(),
|
|
'Test Server 1',
|
|
'Dell R720',
|
|
'Intel Xeon E5-2680 v2',
|
|
10,
|
|
2,
|
|
128,
|
|
'https://proxmox1.example.com:8006'
|
|
); |