Configuration > Plan Settings, parameter * plan_currency), so the per-record currency columns are dropped: plans.currency, * plan_allocation_items.planned_currency and plan_allocation_items.real_currency. Amounts are kept as they * are. Each column is dropped only if it exists. */ class Version_0_8_0 extends AbstractMigration { /** * Table => columns to drop. */ private const COLUMNS = [ Plan::TABLE_NAME => ['currency'], PlanAllocationItem::TABLE_NAME => ['planned_currency', 'real_currency'], ]; protected function isApplicable(Schema $schema): bool { return [] !== $this->getColumnsToDrop($schema); } protected function up(): void { $schema = $this->entityManager->getConnection()->createSchemaManager()->introspectSchema(); foreach ($this->getColumnsToDrop($schema) as $table => $columns) { foreach ($columns as $column) { $this->addSql("ALTER TABLE {$table} DROP COLUMN {$column}"); } } } /** * @return array prefixed table => existing columns to drop */ private function getColumnsToDrop(Schema $schema): array { $drop = []; foreach (self::COLUMNS as $table => $columns) { $table = $this->concatPrefix($table); if (!$schema->hasTable($table)) { continue; } $existing = array_values(array_filter($columns, fn (string $column): bool => $schema->getTable($table)->hasColumn($column))); if ([] !== $existing) { $drop[$table] = $existing; } } return $drop; } }