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 Version20251114114000 extends AbstractMigration
|
||||
|
||||
public function up(Schema $schema): void
|
||||
{
|
||||
if ($this->isSqlite()) {
|
||||
// SQLite schema never created the legacy columns.
|
||||
return;
|
||||
}
|
||||
// Guard: drop columns only if they exist
|
||||
$this->addSql(<<<'SQL'
|
||||
DO $$
|
||||
@@ -35,11 +39,19 @@ SQL);
|
||||
|
||||
public function down(Schema $schema): void
|
||||
{
|
||||
if ($this->isSqlite()) {
|
||||
return;
|
||||
}
|
||||
// Recreate columns as nullable in down migration
|
||||
$this->addSql('ALTER TABLE reviews ADD spotify_album_id VARCHAR(64) DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE reviews ADD album_name VARCHAR(255) DEFAULT NULL');
|
||||
$this->addSql('ALTER TABLE reviews ADD album_artist VARCHAR(255) DEFAULT NULL');
|
||||
}
|
||||
|
||||
private function isSqlite(): bool
|
||||
{
|
||||
return $this->connection->getDatabasePlatform()->getName() === 'sqlite';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user