fedi-feed-router/bin/migrate

28 lines
788 B
Text
Raw Normal View History

#!/usr/bin/env php
<?php
require __DIR__ . '/../vendor/autoload.php';
2025-06-28 11:36:16 +02:00
// Ensure database file exists
$dbPath = __DIR__ . '/../storage/database.sqlite';
if (!file_exists($dbPath)) {
touch($dbPath);
}
require __DIR__ . '/../bootstrap/database.php';
use Illuminate\Filesystem\Filesystem;
use Illuminate\Database\Migrations\DatabaseMigrationRepository;
use Illuminate\Database\Migrations\Migrator;
$repository = new DatabaseMigrationRepository($capsule->getDatabaseManager(), 'migrations');
$migrator = new Migrator($repository, $capsule->getDatabaseManager(), new Filesystem);
if (! $repository->repositoryExists()) {
$repository->createRepository();
echo "Migration table created.\n";
}
$migrator->run(__DIR__ . '/../database/migrations');
echo "Migrations complete.\n";