<?php
/**
 * Add Working Hours Field to Stores Table
 * This script adds a field for store owners to set working hours from Monday to Saturday
 * 
 * Field added:
 * - working_hours: JSON field storing working hours for Monday to Saturday
 */

require_once 'config.php';

echo "=== Adding Store Working Hours Field ===\n\n";

// Check if working_hours column exists
$checkCol = $conn->query("SHOW COLUMNS FROM stores LIKE 'working_hours'");
if ($checkCol->num_rows == 0) {
    $alterSql = "ALTER TABLE stores ADD COLUMN working_hours JSON NULL AFTER form_theme";
    if ($conn->query($alterSql)) {
        echo "✓ Added 'working_hours' column\n";
    } else {
        echo "✗ Error adding working_hours: " . $conn->error . "\n";
        exit(1);
    }
} else {
    echo "✓ 'working_hours' column already exists\n";
}

echo "\n=== Done! ===\n";
echo "Store owners can now set working hours from Monday to Saturday.\n";
?>

