#!/usr/bin/env php listAllMigrations(); $applied = $runner->listAppliedMigrations(); $pending = $runner->listPendingMigrations(); echo "All migrations (" . count($all) . "):\n"; foreach ($all as $m) echo " - $m\n"; echo "\nApplied (" . count($applied) . "):\n"; foreach ($applied as $m) echo " - $m\n"; echo "\nPending (" . count($pending) . "):\n"; foreach ($pending as $m) echo " - $m\n"; echo "\n"; exit(0); } elseif ($action === 'up') { $pending = $runner->listPendingMigrations(); if (empty($pending)) { echo "No pending migrations.\n"; exit(0); } echo "Applying " . count($pending) . " migration(s):\n"; foreach ($pending as $m) echo " - $m\n"; $applied = $runner->applyPendingMigrations(); echo "\nApplied successfully: " . count($applied) . "\n"; exit(0); } else { printUsage(); exit(1); } } catch (Throwable $e) { fwrite(STDERR, "Migration error: " . $e->getMessage() . "\n"); exit(1); }