exec($sql); echo "Successfully ran migration: " . basename($file) . "\n"; } catch (PDOException $e) { echo "Error running migration " . basename($file) . ": " . $e->getMessage() . "\n"; } } } if (php_sapi_name() === 'cli' || isset($_GET['run'])) { runMigrations(); }