Moved constants out of misuzu.php.

This commit is contained in:
flash 2025-02-09 20:44:10 +00:00
parent 1d54d41f6b
commit 4110cd5190
16 changed files with 77 additions and 50 deletions

View file

@ -1,13 +1,13 @@
#!/usr/bin/env php
<?php
use Index\Db\Migration\FsDbMigrationRepo;
require_once __DIR__ . '/../misuzu.php';
try {
touch(MSZ_ROOT . '/.migrating');
chmod(MSZ_ROOT . '/.migrating', 0777);
$lockPath = $msz->dbCtx->getMigrateLockPath();
if(is_file($lockPath))
die('A migration script is already running.' . PHP_EOL);
touch($lockPath);
try {
echo 'Creating migration manager...' . PHP_EOL;
$manager = $msz->dbCtx->createMigrationManager();
@ -29,6 +29,8 @@ try {
}
echo PHP_EOL;
} catch(Exception $ex) {
var_dump($ex);
} finally {
unlink(MSZ_ROOT . '/.migrating');
unlink($lockPath);
}

12
tools/migrate-override-toggle Executable file
View file

@ -0,0 +1,12 @@
#!/usr/bin/env php
<?php
require_once __DIR__ . '/../misuzu.php';
$lockPath = $msz->dbCtx->getMigrateLockPath();
if(is_file($lockPath)) {
printf('Removing migration lock...%s', PHP_EOL);
unlink($lockPath);
} else {
printf('Setting migration lock...%s', PHP_EOL);
touch($lockPath);
}