Files
nabeh/backend/public/run_migrations_temp.php
2026-05-22 23:55:19 +03:00

36 lines
916 B
PHP

<?php
require_once dirname(__DIR__) . '/app/bootstrap.php';
use App\Core\Database;
header('Content-Type: text/plain; charset=utf-8');
try {
echo "Connecting to database...\n";
$pdo = Database::getConnection();
$sqlFile = dirname(__DIR__) . '/create_saas_and_woocommerce_tables.sql';
if (!file_exists($sqlFile)) {
throw new \Exception("SQL file not found at: " . $sqlFile);
}
echo "Reading SQL file...\n";
$sql = file_get_contents($sqlFile);
echo "Executing SQL statements...\n";
$pdo->exec($sql);
echo "Migration completed successfully!\n";
// Verify tables
$stmt = $pdo->query("SHOW TABLES");
$tables = $stmt->fetchAll(PDO::FETCH_COLUMN);
echo "Current database tables:\n";
foreach ($tables as $t) {
echo "- $t\n";
}
} catch (\Exception $e) {
echo "Migration failed: " . $e->getMessage() . "\n";
}