wtf
All checks were successful
CI - Build Tonehaus Docker image / tonehaus-ci-build (push) Successful in 2m0s
All checks were successful
CI - Build Tonehaus Docker image / tonehaus-ci-build (push) Successful in 2m0s
This commit is contained in:
@@ -16,6 +16,10 @@ final class Version20251114120500 extends AbstractMigration
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
if ($this->isSqlite()) {
|
||||
// SQLite schema already ships with these columns/defaults.
|
||||
return;
|
||||
}
|
||||
$this->addSql("ALTER TABLE albums ADD local_id VARCHAR(64) DEFAULT NULL");
|
||||
$this->addSql("ALTER TABLE albums ADD source VARCHAR(16) NOT NULL DEFAULT 'spotify'");
|
||||
$this->addSql("ALTER TABLE albums ADD created_by_id INT DEFAULT NULL");
|
||||
@@ -28,6 +32,9 @@ final class Version20251114120500 extends AbstractMigration
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
if ($this->isSqlite()) {
|
||||
return;
|
||||
}
|
||||
$this->addSql("ALTER TABLE albums DROP CONSTRAINT FK_F4E2474FB03A8386");
|
||||
$this->addSql("DROP INDEX IF EXISTS uniq_album_local_id");
|
||||
$this->addSql("DROP INDEX IF EXISTS IDX_F4E2474FB03A8386");
|
||||
@@ -36,6 +43,11 @@ final class Version20251114120500 extends AbstractMigration
|
||||
$this->addSql("ALTER TABLE albums DROP COLUMN created_by_id");
|
||||
$this->addSql("ALTER TABLE albums ALTER spotify_id SET NOT NULL");
|
||||
}
|
||||
|
||||
private function isSqlite(): bool
|
||||
{
|
||||
return $this->connection->getDatabasePlatform()->getName() === 'sqlite';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user