MySQL Database Module
MySQL Database Starter and Migration
Module Dependency
Add module dependency to your pom file.
<dependency>
<groupId>org.archmix</groupId>
<artifactId>legolas-mysql</artifactId>
<version>${legolasVersion}</version>
</dependency>Starter
This module provides a MySQL Starter as a managed container. The behavior may vary depends on the Runtime Environment you set.
Runtime Environment
Starter Behavior
LOCAL
A managed docker container will be created. The same container will be used for every execution, unless you destroy container by command line.
TEST
A managed docker container will be created and destroyed since test finishs.
SERVER
None container will be created or used.
Database Properties
Property
Value
Host
localhost
Port
3306
User
$(whoami)
Password
postgre
Database
$(whoami) lower case
Running Instance Configuration
In order to get all the configurations through the code, you should do:
Migration
Migration will be running on every Runtime Environment unless you put no files in the target folder. The target folder is src/main/resources/services/mysql/migration. The file name should obey the following standard: V999_Description_of_what_this_file_do.sql. All the statements should be ended with ;
Example
Imagine you want to create a table called table_name with id and name columns. In order to do this you should create a file with the following path and name:
src/main/resources/services/mysql/migration/V001_Create_Table_Name.sql
Last updated
Was this helpful?
