MySQL

Testing

To test against MySQL docker test container set the platform to mysql in src/test/resources/application-test.yaml

Refer to docs / testing if application-test.yaml doesn't exist yet.

ebean:
  test:
  platform: mysql # h2, mysql, ...
    ddlMode: dropCreate # none | dropCreate | migration
    dbName: my_app

That is all we need to do. Running tests via IDE, maven or gradle will all automatically setup a docker test container for mysql including creating the database and user etc.

We generally run with ddlMode dropCreate which will drop and re-create all the database tables prior to running all the tests.

Refer to docs / logging to see how to get logging for SQL, DDL and docker.

Note that DDL is generated into maven target, gradle build or current directory. We see db-create-all.sql and db-drop-all.sql there.

Types

UUID

UUID is not a native MySQL type and can be mapped to either BINARY(16) or VARCHAR(36).

JSON

We can use @DbJson to map content.

History support

History support for MySQL is provided by generating triggers and history table.

Edit Page