CREATE TABLE IF NOT EXISTS reviews (
    id INT PRIMARY KEY AUTO_INCREMENT,
    studio_id INT NOT NULL,
    author_name VARCHAR(255) NOT NULL,
    author_email VARCHAR(255),
    rating TINYINT NOT NULL CHECK (rating BETWEEN 1 AND 5),
    text TEXT,
    reply TEXT,
    reply_at DATETIME,
    is_approved TINYINT(1) DEFAULT 0,
    source ENUM('platform', 'google_import') DEFAULT 'platform',
    created_at DATETIME DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (studio_id) REFERENCES studios(id) ON DELETE CASCADE,
    INDEX idx_studio (studio_id),
    INDEX idx_approved (is_approved)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
