exec("CREATE TABLE IF NOT EXISTS migrations (migration VARCHAR(255) PRIMARY KEY, created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP)"); $ran_migrations_stmt = $pdo->query("SELECT migration FROM migrations"); $ran_migrations = $ran_migrations_stmt->fetchAll(PDO::FETCH_COLUMN); $migration_files = glob('db/migrations/*.sql'); sort($migration_files); foreach ($migration_files as $file) { $migration_name = basename($file); if (!in_array($migration_name, $ran_migrations)) { $sql = file_get_contents($file); $pdo->exec($sql); $stmt = $pdo->prepare("INSERT INTO migrations (migration) VALUES (?)"); $stmt->execute([$migration_name]); } } } catch (Exception $e) { // In a real app, you'd want to log this error and show a user-friendly message. die("Database migration failed: " . $e->getMessage()); } ?> My Deals - LTD Tracker
Total Deals

0

Total Spent

$0.00

Average Rating

0.0

New Deals (30d)

0

Deals by Category

My Deals

Name Vendor Category Purchase Date Price Rating Website Actions