GenerateMigrationsMojo

@Mojo(name = "generate-migrations", requiresDependencyResolution = ResolutionScope.RUNTIME, threadSafe = true)
@Execute(phase = LifecyclePhase.COMPILE)
class GenerateMigrationsMojo : AbstractMojo

Mojo for generating SQL migration scripts from Exposed table definitions.

Goal: exposed:generate-migrations.

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
@Parameter(property = "exposed.migrations.databasePassword")
var databasePassword: String?

Password for the database connection. Required when testContainersImageName is not set.

Link copied to clipboard
@Parameter(property = "exposed.migrations.databaseUrl")
var databaseUrl: String?

JDBC URL for the live database treated as the current schema. Required when testContainersImageName is not set.

Link copied to clipboard
@Parameter(property = "exposed.migrations.databaseUser")
var databaseUser: String?

Username for the database connection. Required when testContainersImageName is not set.

Link copied to clipboard
@Parameter(property = "exposed.migrations.debug", defaultValue = "false")
var debug: Boolean

Whether to enable debug logging.

Link copied to clipboard
@Parameter(property = "exposed.migrations.fileDirectory", defaultValue = "${project.basedir}/src/main/resources/db/migration")
lateinit var fileDirectory: File

Directory where generated migration scripts will be stored. Defaults to src/main/resources/db/migration relative to the project root.

Link copied to clipboard
@Parameter(property = "exposed.migrations.fileExtension", defaultValue = ".sql")
var fileExtension: String

File extension for migration scripts. Defaults to .sql.

Link copied to clipboard
@Parameter(property = "exposed.migrations.filePrefix", defaultValue = "V")
var filePrefix: String

Prefix for migration script names. Defaults to V.

Link copied to clipboard
@Parameter(property = "exposed.migrations.fileSeparator", defaultValue = "__")
var fileSeparator: String

Separator for migration script names. Defaults to __.

Link copied to clipboard
@Parameter(property = "exposed.migrations.fileVersionFormat", defaultValue = "TIMESTAMP_ONLY")
var fileVersionFormat: VersionFormat

Version format for migration script names. Defaults to using the full current timestamp (with seconds) in the format YYYYMMDDHHMMSS.

Link copied to clipboard
@Parameter(property = "exposed.migrations.filename")
var fullFileName: String?

Override that writes all migration statements to a single file with the given name. Must include the file extension. When set, all other filename configuration is ignored.

Link copied to clipboard
open var log: Log?
Link copied to clipboard
open var pluginContext: Map<*, *>?
Link copied to clipboard
@Parameter(property = "exposed.migrations.tablesPackage", required = true)
lateinit var tablesPackage: String

Package name where Exposed table definitions are located.

Link copied to clipboard
@Parameter(property = "exposed.migrations.testContainersImageName")
var testContainersImageName: String?

Docker image name. When set, a Testcontainer is started and existing scripts in fileDirectory are applied via Flyway before generating new ones. Mutually exclusive with the live-database connection parameters.

Link copied to clipboard
@Parameter(property = "exposed.migrations.useUpperCaseDescription", defaultValue = "true")
var useUpperCaseDescription: Boolean

Whether the descriptive part of migration script names should be all upper-case. Defaults to true.

Functions

Link copied to clipboard
open override fun execute()