34007-vm/db/config.php
Flatlogic Bot 1f2c647afc www
2025-09-19 07:15:53 +00:00

34 lines
972 B
PHP

<?php
// Generated by setup_mariadb_project.sh — edit as needed.
define('DB_HOST', '127.0.0.1');
define('DB_NAME', 'app_30855');
define('DB_USER', 'app_30855');
define('DB_PASS', 'eee81949-37de-47f9-a26f-14ebc8402f7f');
function db() {
static $pdo;
if (!$pdo) {
$pdo = new PDO('mysql:host='.DB_HOST.';dbname='.DB_NAME.';charset=utf8mb4', DB_USER, DB_PASS, [
PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC,
]);
}
return $pdo;
}
function run_migrations() {
$pdo = db();
$migration_files = glob(__DIR__ . '/migrations/*.sql');
foreach ($migration_files as $file) {
try {
$sql = file_get_contents($file);
$pdo->exec($sql);
} catch (PDOException $e) {
// Log error or handle it as needed
error_log("Migration failed for file: " . basename($file) . " with error: " . $e->getMessage());
}
}
}
run_migrations();