MySql

Collation

With MySql can (and probably should) specify the collation and character set we want the database to use. In the example below we specify the collation as utf8mb4_unicode_ci.

ebean:
  test:
    platform: mysql #, h2, postgres, mysql, oracle, sqlserver
    ddlMode: dropCreate # none | dropCreate | create | migration | createOnly | migrationDropCreate
    dbName: test
    mysql:
      collation: utf8mb4_unicode_ci
      characterSet: utf8mb4

In the logs with logging DEBUG level for io.ebean.docker we can see: --character-set-server and --collation-server

... INFO  io.ebean.docker.commands.Commands - Run container ut_mysql with port:4306 db:my_app user:my_app mode:Create shutdown:
... DEBUG io.ebean.docker.commands.Commands - docker run -d --name ut_mysql -p 4306:3306 -e MYSQL_ROOT_PASSWORD=admin mysql:5.6 --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_cs

"default" - Collation

We can specify the collation to be default and with that the collection will be left up to the default that MySql would use.

ebean:
  test:
    platform: mysql #, h2, postgres, mysql, oracle, sqlserver
    ddlMode: dropCreate # none | dropCreate | create | migration | createOnly | migrationDropCreate
    dbName: test
    mysql:
      version: 8.0
      collation: default

In the logs with logging DEBUG level for io.ebean.docker we can see: --character-set-server and --collation-server

... INFO  io.ebean.docker.commands.Commands - Run container ut_mysql with port:4306 db:my_app user:my_app mode:Create shutdown:
... DEBUG io.ebean.docker.commands.Commands - docker run -d --name ut_mysql -p 4306:3306 -e MYSQL_ROOT_PASSWORD=admin mysql:5.6