38471-vm/db/migrations/20260220_license_server_schema.sql
2026-02-20 02:28:04 +00:00

24 lines
830 B
SQL

-- Migration: Create server-side license tables
-- Target: u128023052_meezan_license (Remote Server)
-- Created at: 2026-02-20
CREATE TABLE IF NOT EXISTS licenses (
id INT AUTO_INCREMENT PRIMARY KEY,
license_key VARCHAR(255) NOT NULL UNIQUE,
max_activations INT DEFAULT 1,
status ENUM('active', 'suspended', 'expired') DEFAULT 'active',
owner VARCHAR(255) DEFAULT NULL,
address TEXT DEFAULT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS activations (
id INT AUTO_INCREMENT PRIMARY KEY,
license_id INT NOT NULL,
fingerprint VARCHAR(255) NOT NULL,
domain VARCHAR(255) DEFAULT NULL,
product VARCHAR(255) DEFAULT NULL,
activated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (license_id) REFERENCES licenses(id) ON DELETE CASCADE
);