Client and backend. This class is shared: the same code is compiled into your app and into your server, so everything on this page works in both.

@Retention(CLASS) @Target({TYPE})

public @interface Migration

Marks a com.codename1.migration.JavaMigration the build should register beside the project’s SQL migration files.

The class needs a public no-argument constructor. It runs once, in version order with the scripts, and its version must not be one a script already uses.

@Migration(version = "4", description = "normalize phone numbers")
public class NormalizePhones implements JavaMigration {
    public void migrate(MigrationContext context) throws IOException {
        // ...
    }
}

Methods

public abstract String version()The version, such as 4 or 2026.05.21.1.
public abstract String description()What the migration does; recorded in the schema history.

Method details

version

public abstract String version()
The version, such as 4 or 2026.05.21.1.

description

public abstract String description()
What the migration does; recorded in the schema history.