mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 14:23:57 -07:00
refactor: Extract hardcoded migrations to class property
This commit is contained in:
parent
46a03a8b86
commit
30c1038b3e
1 changed files with 13 additions and 8 deletions
|
@ -19,6 +19,10 @@ class MigrationStatus
|
||||||
{
|
{
|
||||||
private string $migrationTable;
|
private string $migrationTable;
|
||||||
private string $migrationPath;
|
private string $migrationPath;
|
||||||
|
private array $initialMigrations = [
|
||||||
|
'20250619000001',
|
||||||
|
'20250619000002'
|
||||||
|
];
|
||||||
|
|
||||||
public function __construct()
|
public function __construct()
|
||||||
{
|
{
|
||||||
|
@ -189,10 +193,11 @@ class MigrationStatus
|
||||||
private function checkInitialMigrationsApplied(): bool
|
private function checkInitialMigrationsApplied(): bool
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
$initialMigrationsCSV = implode(',', $this->initialMigrations);
|
||||||
$result = DB()->query("
|
$result = DB()->query("
|
||||||
SELECT COUNT(*) as migration_count
|
SELECT COUNT(*) as migration_count
|
||||||
FROM {$this->migrationTable}
|
FROM {$this->migrationTable}
|
||||||
WHERE version IN ('20250619000001', '20250619000002')
|
WHERE version IN ($initialMigrationsCSV)
|
||||||
")->fetch();
|
")->fetch();
|
||||||
|
|
||||||
return $result && $result->migration_count >= 2;
|
return $result && $result->migration_count >= 2;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue