Deploy: 2026-05-22 23:55:19
This commit is contained in:
35
backend/public/run_migrations_temp.php
Normal file
35
backend/public/run_migrations_temp.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?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";
|
||||
}
|
||||
Reference in New Issue
Block a user