-- PHP User Registration - Migration: admin + contact
-- Developer: Molla Samser | RSK World - https://rskworld.in
-- Contact: help@rskworld.in | +91 93305 39277
-- Year: 2026
-- Run once on existing database. Select your database first, then run.

ALTER TABLE users ADD COLUMN is_admin TINYINT(1) DEFAULT 0 AFTER last_login_at;

CREATE TABLE IF NOT EXISTS contact_messages (
    id INT UNSIGNED AUTO_INCREMENT PRIMARY KEY,
    name VARCHAR(100) NOT NULL,
    email VARCHAR(255) NOT NULL,
    subject VARCHAR(255) NOT NULL,
    message TEXT NOT NULL,
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    INDEX idx_created (created_at)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

-- Optional: set first user as admin (uncomment and run once):
-- UPDATE users SET is_admin = 1 ORDER BY id ASC LIMIT 1;
