restore best-effort behavior of afterColumn
See original GitHub issueEnvironment
Liquibase Version: 4.13.0
Liquibase Integration & Version: gradle, spring boot
Liquibase Extension(s) & Version:
Database Vendor & Version: mysql, postgresql
Operating System Type & Version:
Infrastructure Type/Provider:
Description
https://github.com/spinnaker/orca (migrations are here) uses afterColumn
in some of its migrations, and tests those migrations using both mysql and postgresql. Before version 4.13.0, and specifically https://github.com/liquibase/liquibase/pull/2943, afterColumn worked with mysql, and did nothing with postgresql. With 4.13.0, afterColumn still works with mysql, but throws a validation error with postgresql. For example:
PgTopApplicationExecutionCleanupPollingNotificationAgentSpec > initializationError FAILED
com.netflix.spinnaker.kork.sql.test.SqlTestUtil$DatabaseInitializationFailed: liquibase.exception.ValidationFailedException: Validation Failed:
4 changes have validation failures
addAfterColumn is not allowed on postgresql, db/changelog/20180510-add-legacy-id-fields.yml::add-legacy-id-fields::cthielen
addAfterColumn is not allowed on postgresql, db/changelog/20180510-add-legacy-id-fields.yml::add-legacy-id-fields::cthielen
addAfterColumn is not allowed on postgresql, db/changelog/20180510-add-legacy-id-fields.yml::add-legacy-id-fields::cthielen
addAfterColumn is not allowed on postgresql, db/changelog/20180510-add-legacy-id-fields.yml::add-legacy-id-fields::cthielen
at com.netflix.spinnaker.kork.sql.test.SqlTestUtil.initDatabase(SqlTestUtil.java:248)
at com.netflix.spinnaker.kork.sql.test.SqlTestUtil.initTcPostgresDatabase(SqlTestUtil.java:97)
at com.netflix.spinnaker.orca.sql.cleanup.PgTopApplicationExecutionCleanupPollingNotificationAgentSpec.getDatabase(TopApplicationExecutionCleanupPollingNotificationAgentSpec.groovy:161)
Caused by:
liquibase.exception.ValidationFailedException: Validation Failed:
4 changes have validation failures
addAfterColumn is not allowed on postgresql, db/changelog/20180510-add-legacy-id-fields.yml::add-legacy-id-fields::cthielen
addAfterColumn is not allowed on postgresql, db/changelog/20180510-add-legacy-id-fields.yml::add-legacy-id-fields::cthielen
addAfterColumn is not allowed on postgresql, db/changelog/20180510-add-legacy-id-fields.yml::add-legacy-id-fields::cthielen
addAfterColumn is not allowed on postgresql, db/changelog/20180510-add-legacy-id-fields.yml::add-legacy-id-fields::cthielen
at liquibase.changelog.DatabaseChangeLog.validate(DatabaseChangeLog.java:307)
at liquibase.Liquibase.lambda$update$1(Liquibase.java:228)
at liquibase.Scope.lambda$child$0(Scope.java:180)
at liquibase.Scope.child(Scope.java:189)
at liquibase.Scope.child(Scope.java:179)
at liquibase.Scope.child(Scope.java:158)
at liquibase.Liquibase.runInScope(Liquibase.java:2400)
at liquibase.Liquibase.update(Liquibase.java:208)
at liquibase.Liquibase.update(Liquibase.java:194)
at liquibase.Liquibase.update(Liquibase.java:190)
at liquibase.Liquibase.update(Liquibase.java:182)
at com.netflix.spinnaker.kork.sql.test.SqlTestUtil.initDatabase(SqlTestUtil.java:246)
... 2 more
One use of afterColumn
is:
- addColumn:
tableName: orchestration_stages
columns:
- column:
name: legacy_id
type: varchar(500)
afterColumn: id
Expected/Desired Behavior
https://github.com/liquibase/liquibase/pull/2943 notes that this is the new behavior. I’d love a way to go back to the old behavior, where addColumn works where supported, and is ignored where it’s not. There are some migrations where adding e.g.:
modifySql:
dbms: "mysql"
append:
value: " after id"
works, but many where it doesn’t.
Issue Analytics
- State:
- Created a year ago
- Reactions:3
- Comments:5 (2 by maintainers)
Top GitHub Comments
thanks @jfisbein - also saw you comment over on #3094. Same issue, different command. Stay tuned.
Turns out that https://github.com/liquibase/liquibase/issues/3094#issuecomment-1194426594 is actually the heart of the matter:
So even if it’s possible to do things with custom sql, the changeset checksums fail.
I think what I’m really asking for is to change this from an enhancement to a bug.