(db) Fix migrations, bump flyway to 10.0.1

Tricky problem, creating a procedure apparently needs delimiter shenanigans in Flyway, otherwise it will truncate the END statement and mariadb will be sad.
This commit is contained in:
Viktor Lofgren 2023-11-21 20:04:18 +01:00
parent e67dcf4d68
commit dd507a3808
2 changed files with 18 additions and 7 deletions

View File

@ -1,8 +1,18 @@
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.flywaydb:flyway-mysql:10.0.1'
}
}
plugins {
id 'java'
id 'jvm-test-suite'
id "org.flywaydb.flyway" version "8.2.0"
id "org.flywaydb.flyway" version "10.0.1"
}
java {
@ -11,6 +21,7 @@ java {
}
}
configurations {
flywayMigration.extendsFrom(implementation)
}
@ -31,7 +42,7 @@ dependencies {
implementation libs.rxjava
implementation libs.bundles.mariadb
flywayMigration 'org.flywaydb:flyway-mysql:9.8.1'
flywayMigration 'org.flywaydb:flyway-mysql:10.0.1'
testImplementation libs.bundles.slf4j.test
testImplementation libs.bundles.junit
@ -50,5 +61,6 @@ flyway {
schemas = ['WMSA_prod']
configurations = [ 'compileClasspath', 'flywayMigration' ]
locations = ['filesystem:src/main/resources/db/migration']
cleanDisabled = false
}

View File

@ -1,10 +1,9 @@
ALTER TABLE WMSA_prod.EC_DOMAIN_LINK
MODIFY COLUMN ID BIGINT NOT NULL AUTO_INCREMENT;
DELIMITER $$
CREATE OR REPLACE PROCEDURE PURGE_LINKS_TABLE (IN nodeId INT)
BEGIN
DELETE EC_DOMAIN_LINK
FROM EC_DOMAIN_LINK INNER JOIN WMSA_prod.EC_DOMAIN
ON EC_DOMAIN_LINK.SOURCE_DOMAIN_ID = EC_DOMAIN.ID
WHERE NODE_AFFINITY = nodeId;
END;
DELETE EC_DOMAIN_LINK FROM EC_DOMAIN_LINK INNER JOIN WMSA_prod.EC_DOMAIN ON EC_DOMAIN_LINK.SOURCE_DOMAIN_ID = EC_DOMAIN.ID WHERE NODE_AFFINITY = nodeId;
END$$
DELIMITER ;