zonkyio / embedded-database-spring-test

A library for creating isolated embedded databases for Spring-powered integration tests.
Apache License 2.0
399 stars 37 forks source link

MySQL - test user - ALTER command denied to user Flyway #200

Closed spec8320 closed 2 years ago

spec8320 commented 2 years ago

Hello,

I think I found a bug. During writing some tests I want to move to AutoConfigureEmbeddedDatabase from pure Docker tests. by simple:

@AutoConfigureEmbeddedDatabase(type = AutoConfigureEmbeddedDatabase.DatabaseType.MYSQL)

As we use flyway scripts to database migration. I saw an error -

----------------------------------------------------------------
SQL State  : 42000
Error Code : 1142
Message    : ALTER command denied to user 'test'@'172.17.0.1' for table 'membership'
Location   : db/migration/V201908201109__alter_tables.sql (D:\Workspaces\IntelliJ_IDEA\amarokbackend\target\classes\db\migration\V201908201109__alter_tables.sql)

I think that test user created by default with zonkyio on MySQL dont have ALTER privilege's - is there any walkaround for this ?

tomix26 commented 2 years ago

Hi @spec8320, I've tested the mysql provider but I'm not experiencing this problem. I tested creating a new table, altering the exising one, inserting new records, and verified all of this on the following mysql versions: 5.6, 5.7, 8.0. However, everything seems to be working fine. So could you please provide me a simple reproducer? You can use the https://github.com/tomix26/embedded-database-demo project as a template for that purpose. Thank you!

tomix26 commented 2 years ago

I'm closing the issue due to inactivity, feel free to reopen it if the problem persists.