Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Flyway update and 2.x migration #614

Merged
merged 12 commits into from
Aug 25, 2020
Merged

Conversation

ZakarFin
Copy link
Member

@ZakarFin ZakarFin commented Aug 24, 2020

Updates Flyway version from 4.2 (necessary upgrade step that migrates Flyway schema history table in Oskari 1.56.0) to latest 6.5.5. This requires a manual update for the Flyway migrations API on any application specific Flyway-modules as follows:

From Oskari 1.56:

import org.flywaydb.core.api.migration.jdbc.JdbcMigration;

public class V[version]__[description] implements JdbcMigration {
    public void migrate(Connection connection) throws Exception { ... }
}

To Oskari 2.0:

import org.flywaydb.core.api.migration.BaseJavaMigration;
import org.flywaydb.core.api.migration.Context;

public class V[version]__[description] extends BaseJavaMigration {
    public void migrate(Context context) throws Exception {
          Connection connection = context.getConnection();
          ....
    }
}

Any new install will have Flyway baselined at 2.0.0 having migrations 2.0.1-2.0.3 to populate the database and any existing install will have the baseline at 2.0.4 which makes Flyway skip the table creation/initial bundles/data population.

Note! All 1.x migrations have been removed from the core module. If you are trying to update from Oskari version that is NOT 1.56 Flyway migrations will fail with multiple messages about "referenced migrations that are unavailable". Please update your application to Oskari 1.56.0 first (just starting the application migrates the db) and update to 2.0 only from 1.56.

Note! You might need to update the existing migration checksums for additional modules by enabling autorepair on oskari-ext.properties with db.flyway.autorepair=true. This is due to Flyway checksum calculation has been updated in the more recent version.

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities (and Security Hotspot 0 Security Hotspots to review)
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ZakarFin ZakarFin added this to the 2.0 milestone Aug 25, 2020
@ZakarFin ZakarFin marked this pull request as ready for review August 25, 2020 14:33
@ZakarFin ZakarFin merged commit abd88cc into oskariorg:develop Aug 25, 2020
@ZakarFin ZakarFin deleted the migration branch October 12, 2021 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant