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

MySQL with GTID consistency enforced fails to create flyway_schema_history table #2535

Closed
GavinFigueroa opened this issue Oct 17, 2019 · 3 comments

Comments

@GavinFigueroa
Copy link

@GavinFigueroa GavinFigueroa commented Oct 17, 2019

Which version and edition of Flyway are you using?

6.0.6 community edition

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)

Gradle plugin

Which database are you using (type & version)?

MySQL 5.7

Which operating system are you using?

MacOS 10.14.6

What did you do?

Attempted to integrate flyway into an existing MySQL database using the gradle flywayMigrate task. The database is hosted on Google Cloud Platform and has binary logs enabled, which forces --enforce-gtid-consistency.

What did you expect to see?

The database should have been updated with the contents of our db.migration scripts.

What did you see instead?

Flyway fails to create the flyway_schema_history table.

  -----------------
  SQL State  : HY000
  Error Code : 1786
  Message    : Statement violates GTID consistency: CREATE TABLE ... SELECT.
  Location   :  ()
  Line       : 1
  Statement  : CREATE TABLE `delivery_confirmation`.`flyway_schema_history` (
      `installed_rank` INT NOT NULL,
      `version` VARCHAR(50),
      `description` VARCHAR(200) NOT NULL,
      `type` VARCHAR(20) NOT NULL,
      `script` VARCHAR(1000) NOT NULL,
      `checksum` INT,
      `installed_by` VARCHAR(100) NOT NULL,
      `installed_on` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
      `execution_time` INT NOT NULL,
      `success` BOOL NOT NULL,
      CONSTRAINT `flyway_schema_history_pk` PRIMARY KEY (`installed_rank`)
  ) ENGINE=InnoDB AS SELECT     1 as "installed_rank",     '1' as "version",     '<< Flyway Baseline >>' as "description",     'BASELINE' as "type",     '<< Flyway Baseline >>' as "script",     NULL as "checksum",     'DELIVERY_CONFIRM' as "installed_by",     CURRENT_TIMESTAMP as "installed_on",     0 as "execution_time",     TRUE as "success"

Disabling binary logs on the target database allows flyway to correctly migrate the database.

@GavinFigueroa GavinFigueroa changed the title MySQL with binary logs fails to create flyway_schema_history table MySQL with GTID consistency enforced fails to create flyway_schema_history table Oct 17, 2019
@david-campbell-deepmatter

This comment has been minimized.

Copy link

@david-campbell-deepmatter david-campbell-deepmatter commented Oct 18, 2019

same problem observed:

Which version and edition of Flyway are you using?
6.0.6 community edition

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Maven plugin

Which database are you using (type & version)?
MySQL 5.7

Which operating system are you using?
Microsoft Windows 10 Pro 10.0.17763

@NEzer2

This comment has been minimized.

Copy link

@NEzer2 NEzer2 commented Oct 27, 2019

same problem observed:

Which version and edition of Flyway are you using?
6.0.7 community edition

Which client are you using? (Command-line, Java API, Maven plugin, Gradle plugin)
Command-line

Which database are you using (type & version)?
MySQL 5.7

@juliahayward juliahayward added this to the Flyway 6.1.0 milestone Oct 31, 2019
@juliahayward

This comment has been minimized.

Copy link
Member

@juliahayward juliahayward commented Oct 31, 2019

We have a reproduction, and will be fixed in 6.1. Thanks for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.