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

Flyway does not clean sequences in MariaDB #2266

Closed
jankoh opened this issue Jan 17, 2019 · 4 comments
Closed

Flyway does not clean sequences in MariaDB #2266

jankoh opened this issue Jan 17, 2019 · 4 comments

Comments

@jankoh
Copy link

@jankoh jankoh commented Jan 17, 2019

Which version and edition of Flyway are you using?

5.2.4

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

gradle client; gradle 4.10.2

Which database are you using (type & version)?

MariaDB, version 10.3.12

Which operating system are you using?

Linux (Arch; Alpine)

What did you do?
  • Create empty Database
  • Run gradle flywayMigrate (database is filled according to the migration scripts)
  • Run gralde flywayClean (database should be cleaned; end empty, as before)
What did you expect to see?

After Clean, the datebase should be empty again.

What did you see instead?

The datebase is empty, except for all the sequences created. Those remain and so a next run of flywayMigrate produces an error, and e manual clean is required.

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Jan 17, 2019

Please share a small SQL script that triggers this behavior.

@jankoh
Copy link
Author

@jankoh jankoh commented Jan 18, 2019

I'll attach the sample "script" (it's a one liner). This is, what happens when using it:

jkohnert@kohnert-n4 ~/Devel $ flyway -user=myuser -password=secret -url=jdbc:mariadb://localhost/test info
Flyway Community Edition 5.2.4 by Boxfuse
Database: jdbc:mariadb://localhost/test (MySQL 10.3)
Schema version: << Empty Schema >>

+----------+---------+-------------+------+--------------+-------+
| Category | Version | Description | Type | Installed On | State |
+----------+---------+-------------+------+--------------+-------+
| No migrations found |
+----------+---------+-------------+------+--------------+-------+

jkohnert@kohnert-n4 ~/Devel $ cat migrations/V0__Test.sql
create sequence test;
jkohnert@kohnert-n4 ~/Devel $ flyway -user=myuser -password=secret -url=jdbc:mariadb://localhost/test -locations=filesystem:migrations migrate
Flyway Community Edition 5.2.4 by Boxfuse
Database: jdbc:mariadb://localhost/test (MySQL 10.3)
Successfully validated 1 migration (execution time 00:00.010s)
Creating Schema History table: test.flyway_schema_history
Current version of schema test: << Empty Schema >>
Migrating schema test to version 0 - Test
Successfully applied 1 migration to schema test (execution time 00:00.096s)
jkohnert@kohnert-n4 ~/Devel $ flyway -user=myuser -password=secret -url=jdbc:mariadb://localhost/test info
Flyway Community Edition 5.2.4 by Boxfuse
Database: jdbc:mariadb://localhost/test (MySQL 10.3)
Schema version: 0

+-----------+---------+-------------+------+---------------------+--------+
| Category | Version | Description | Type | Installed On | State |
+-----------+---------+-------------+------+---------------------+--------+
| Versioned | 0 | Test | SQL | 2019-01-18 15:23:42 | Future |
+-----------+---------+-------------+------+---------------------+--------+

jkohnert@kohnert-n4 ~/Devel $ flyway -user=myuser -password=secret -url=jdbc:mariadb://localhost/test clean
Flyway Community Edition 5.2.4 by Boxfuse
Database: jdbc:mariadb://localhost/test (MySQL 10.3)
Successfully cleaned schema test (execution time 00:00.007s)
jkohnert@kohnert-n4 ~/Devel $ flyway -user=myuser -password=secret -url=jdbc:mariadb://localhost/test info
Flyway Community Edition 5.2.4 by Boxfuse
Database: jdbc:mariadb://localhost/test (MySQL 10.3)
Schema version: << Empty Schema >>

+----------+---------+-------------+------+--------------+-------+
| Category | Version | Description | Type | Installed On | State |
+----------+---------+-------------+------+--------------+-------+
| No migrations found |
+----------+---------+-------------+------+--------------+-------+

jkohnert@kohnert-n4 ~/Devel $ flyway -user=myuser -password=secret -url=jdbc:mariadb://localhost/test -locations=filesystem:migrations migrate
Flyway Community Edition 5.2.4 by Boxfuse
Database: jdbc:mariadb://localhost/test (MySQL 10.3)
Successfully validated 1 migration (execution time 00:00.010s)
ERROR: Found non-empty schema(s) test without schema history table! Use baseline() or set baselineOnMigrate to true to initialize the schema history table.
jkohnert@kohnert-n4 ~/Devel $

@jankoh
Copy link
Author

@jankoh jankoh commented Jan 18, 2019

@axelfontaine
Copy link
Contributor

@axelfontaine axelfontaine commented Feb 11, 2019

Thanks for reporting and providing the small sample SQL. Fixed.

dohrayme pushed a commit to dohrayme/flyway that referenced this issue Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants