Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix database migration for MySQL #685

Merged
merged 3 commits into from
Jul 1, 2022

Conversation

itsouvalas
Copy link
Contributor

@itsouvalas itsouvalas commented Jun 1, 2022

When using external mysql database the following error is logged:

Starting Liquibase at 11:50:14 (version 4.9.1 #1978 built at 2022-03-28 19:39+0000)
Running Changeset: databasechangelog-primarykey.yml::1::aqan213
Unexpected error running Liquibase: Migration failed for change set databasechangelog-primarykey.yml::1::aqan213:
     Reason: liquibase.exception.DatabaseException: Multiple primary key defined [Failed SQL: (1068) ALTER TABLE autoscaler.DATABASECHANGELOG ADD PRIMARY KEY (id, author, filename)]

Checking the database we do see the primary keys:

Screenshot 2022-05-31 at 3 11 07 PM

and the change to be executed at least once:

Screenshot 2022-06-01 at 9 51 46 AM

Though the constraint name is PRIMARY

Screenshot 2022-06-01 at 2 05 35 PM

This is already disccussed here

With that in mind, the following change updates the preConditions to match on PRIMARY instead of PK_DATABASECHANGELOG. Subsequent deploys honour that and go through fine.

@silvestre silvestre changed the title Databasechangelog Fix database migration for MySQL Jun 1, 2022
@silvestre
Copy link
Member

/easycla

@silvestre silvestre added the allow-acceptance-tests This label needs to be added to enable the acceptance tests to run. label Jun 21, 2022
Copy link
Member

@silvestre silvestre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately we currently don't run the acceptance tests with MySQL/MariaDB. We will work on that.

Apart from that, LGTM.

@silvestre
Copy link
Member

Running acceptance tests via #718 - will merge this one once it passes.

@silvestre silvestre self-assigned this Jul 1, 2022
@silvestre
Copy link
Member

The acceptance successfully passed on
image
using the cherry-picked commits from this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
allow-acceptance-tests This label needs to be added to enable the acceptance tests to run. approved bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants