Skip to content

Configuration

Kenji Otsuka edited this page May 4, 2019 · 4 revisions

You can configure harmonica in build.gradle as follows.

Migration Directory

You can specify the path of the migration files from the project root directory.

extensions.extraProperties["directoryPath"] =
        "src/main/kotlin/com/improve_future/harmonica_test/jarmonica"

When you specify it, the migration package name is automatically changed according to its path.

Migration Package

You can specify the package name of the migration files.

extensions.extraProperties["migrationPackage"] =
        [project.group, project.rootProject.name, project.name].join(".")

When you specify it, the migration package name is automatically changed according to its path. If you specify the path, too, the automatic configuration is invalid.

Table Name Pluralization

This feature is available in Jarmonica from 1.1.19,

If you configure as follows, refer method control reference column.

extensions.extraProperties["tableNamePluralization"] = true

This library is designed to use with singular table names, such as user table, session table and so on. So refer("users") creates users_id column.

But some people use plural table names, such as users table, sessions table and so on, and they prefer the reference column composed of the singular name and "id" such as "user_id". To create such column, you must write like refer("users", columnName = "user_id") unless configure tableNamePluralization. If you set the preceding configuration, the column user_id is created when you write only refer("users").

Clone this wiki locally