Closed trajano closed 8 months ago
This feature involves modifications to MySqlConnection.init
and QueryFlow.clientCapability
.
If the createDatabaseIfNotExists
is enabled, then disableConnectWithDatabase
whatever database
is set or not. Then HandshakeResponse.encode
will not send database
to server on handshake. After handshake succeed, send CREATE DATABASE IF NOT EXISTS
query and COM_INIT_DB
command if the createDatabaseIfNotExists
is enabled.
One thing that can be optimized here is that we can try to send only COM_INIT_DB
first, and then if it fails, try to send CREATE
statement and COM_INIT_DB
again.
This feature can also be enhanced for those server versions that do not support initializing the database over the handshake protocol.
Is your feature request related to a problem? Please describe. Because R2DBC kicks in before Liquibase and the mysql driver doesn't support auto creation, it fails creating the connection as the database does not exist
Describe the solution you'd like Same as JDBC MySQL createDatabaseIfNotExists=true property
Additional context Add any other context or screenshots about the feature request here.