Search in sources :

Example 11 with MigrationVersion

use of org.flywaydb.core.api.MigrationVersion in project flyway by flyway.

the class MigrationInfoHelperSmallTest method extractSchemaVersionWithLeadingZeroes.

/**
     * Tests a schema version that includes a version with leading zeroes.
     */
@Test
public void extractSchemaVersionWithLeadingZeroes() {
    Pair<MigrationVersion, String> info = MigrationInfoHelper.extractVersionAndDescription("009_4__EmailAxel", "", "__", "");
    MigrationVersion version = info.getLeft();
    String description = info.getRight();
    assertEquals("009.4", version.toString());
    assertEquals("EmailAxel", description);
}
Also used : MigrationVersion(org.flywaydb.core.api.MigrationVersion) Test(org.junit.Test)

Example 12 with MigrationVersion

use of org.flywaydb.core.api.MigrationVersion in project flyway by flyway.

the class MigrationInfoHelperSmallTest method extractSchemaVersionWithVUnderscorePrefix.

@Test
public void extractSchemaVersionWithVUnderscorePrefix() {
    Pair<MigrationVersion, String> info = MigrationInfoHelper.extractVersionAndDescription("V_8_0__Description.sql", "V_", "__", ".sql");
    MigrationVersion version = info.getLeft();
    String description = info.getRight();
    assertEquals("8.0", version.toString());
    assertEquals("Description", description);
}
Also used : MigrationVersion(org.flywaydb.core.api.MigrationVersion) Test(org.junit.Test)

Example 13 with MigrationVersion

use of org.flywaydb.core.api.MigrationVersion in project flyway by flyway.

the class MigrationInfoHelperSmallTest method extractSchemaVersionWithDescription.

/**
     * Tests a schema version that includes a description.
     */
@Test
public void extractSchemaVersionWithDescription() {
    Pair<MigrationVersion, String> info = MigrationInfoHelper.extractVersionAndDescription("9_4__EmailAxel", "", "__", "");
    MigrationVersion version = info.getLeft();
    String description = info.getRight();
    assertEquals("9.4", version.toString());
    assertEquals("EmailAxel", description);
}
Also used : MigrationVersion(org.flywaydb.core.api.MigrationVersion) Test(org.junit.Test)

Example 14 with MigrationVersion

use of org.flywaydb.core.api.MigrationVersion in project flyway by flyway.

the class MigrationInfoHelperSmallTest method repeatableMigration.

@Test
public void repeatableMigration() {
    Pair<MigrationVersion, String> info = MigrationInfoHelper.extractVersionAndDescription("R__EmailAxel.sql", "R", "__", ".sql");
    MigrationVersion version = info.getLeft();
    String description = info.getRight();
    assertNull(version);
    assertEquals("EmailAxel", description);
}
Also used : MigrationVersion(org.flywaydb.core.api.MigrationVersion) Test(org.junit.Test)

Example 15 with MigrationVersion

use of org.flywaydb.core.api.MigrationVersion in project flyway by flyway.

the class MigrationInfoHelperSmallTest method extractSchemaVersionWithDescriptionWithSpaces.

/**
     * Tests a schema version that includes a description with spaces.
     */
@Test
public void extractSchemaVersionWithDescriptionWithSpaces() {
    Pair<MigrationVersion, String> info = MigrationInfoHelper.extractVersionAndDescription("9_4__Big_jump", "", "__", "");
    MigrationVersion version = info.getLeft();
    String description = info.getRight();
    assertEquals("9.4", version.toString());
    assertEquals("Big jump", description);
}
Also used : MigrationVersion(org.flywaydb.core.api.MigrationVersion) Test(org.junit.Test)

Aggregations

MigrationVersion (org.flywaydb.core.api.MigrationVersion)40 Test (org.junit.Test)27 SQLException (java.sql.SQLException)9 MigrationInfo (org.flywaydb.core.api.MigrationInfo)8 FlywayException (org.flywaydb.core.api.FlywayException)7 HashMap (java.util.HashMap)6 AppliedMigration (org.flywaydb.core.internal.metadatatable.AppliedMigration)6 ResolvedMigrationImpl (org.flywaydb.core.internal.resolver.ResolvedMigrationImpl)6 MigrationType (org.flywaydb.core.api.MigrationType)4 ArrayList (java.util.ArrayList)3 MigrationChecksumProvider (org.flywaydb.core.api.migration.MigrationChecksumProvider)3 MigrationInfoProvider (org.flywaydb.core.api.migration.MigrationInfoProvider)3 MigrationExecutor (org.flywaydb.core.api.resolver.MigrationExecutor)3 ResolvedMigration (org.flywaydb.core.api.resolver.ResolvedMigration)3 FlywaySqlScriptException (org.flywaydb.core.internal.dbsupport.FlywaySqlScriptException)3 Date (java.util.Date)2 FlywaySqlException (org.flywaydb.core.internal.dbsupport.FlywaySqlException)2 PlaceholderReplacer (org.flywaydb.core.internal.util.PlaceholderReplacer)2 StopWatch (org.flywaydb.core.internal.util.StopWatch)2 TransactionTemplate (org.flywaydb.core.internal.util.jdbc.TransactionTemplate)2