Deploy from Lumerel

This commit is contained in:
Lumerel Deploy
2026-03-24 21:32:50 +00:00
commit b0ca04b730
10 changed files with 1898 additions and 0 deletions

25
migrate.php Normal file
View File

@@ -0,0 +1,25 @@
<?php
require_once __DIR__ . '/db.php';
$pdo->exec("CREATE TABLE IF NOT EXISTS migrations (
id INT AUTO_INCREMENT PRIMARY KEY,
migration VARCHAR(255) NOT NULL UNIQUE,
ran_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
)");
$ran = $pdo->query("SELECT migration FROM migrations")->fetchAll(PDO::FETCH_COLUMN);
$files = glob(__DIR__ . '/migrations/*.php');
sort($files);
foreach ($files as $file) {
$name = basename($file);
if (!in_array($name, $ran)) {
require $file;
$stmt = $pdo->prepare("INSERT INTO migrations (migration) VALUES (?)");
$stmt->execute([$name]);
echo "Ran: {$name}\n";
}
}
echo "Migrations complete.\n";