<?php
/**
 * Migration Runner: Add cost column to products table
 * Run this script to add the missing cost column
 */

require_once __DIR__ . '/config/config.php';
require_once __DIR__ . '/config/database.php';

echo "Running Add Cost to Products Migration...\n";

try {
    $sql = file_get_contents(__DIR__ . '/database/migrations/add_cost_to_products.sql');
    
    if ($sql === false) {
        die("Error: Could not read migration file.\n");
    }
    
    $db = db();
    $db->exec($sql);
    
    echo "✓ Cost column added to products table successfully!\n";
    
} catch (PDOException $e) {
    echo "✗ Migration failed: " . $e->getMessage() . "\n";
    exit(1);
}

echo "\nMigration complete!\n";
