diff --git a/dinky-admin/pom.xml b/dinky-admin/pom.xml
index ca8574c9a3..0621004116 100644
--- a/dinky-admin/pom.xml
+++ b/dinky-admin/pom.xml
@@ -355,10 +355,6 @@
org.flywaydb
flyway-core
-
- org.flywaydb
- flyway-mysql
-
org.dinky
dinky-alert-dingtalk
diff --git a/dinky-admin/src/main/java/org/flywaydb/core/internal/database/postgresql/PostgreSQLDatabase.java b/dinky-admin/src/main/java/org/flywaydb/core/internal/database/postgresql/PostgreSQLDatabase.java
index 17597ec7eb..86f9302dcc 100644
--- a/dinky-admin/src/main/java/org/flywaydb/core/internal/database/postgresql/PostgreSQLDatabase.java
+++ b/dinky-admin/src/main/java/org/flywaydb/core/internal/database/postgresql/PostgreSQLDatabase.java
@@ -73,7 +73,7 @@ public String getRawCreateScript(Table table, boolean baseline) {
String tablespace =
configuration.getTablespace() == null ? "" : " TABLESPACE \"" + configuration.getTablespace() + "\"";
- return "CREATE TABLE " + table + " (\n" + " \"installed_rank\" INT NOT NULL,\n"
+ return "CREATE TABLE " + table.getName() + " (\n" + " \"installed_rank\" INT NOT NULL,\n"
+ " \"version\" VARCHAR(50),\n"
+ " \"description\" VARCHAR(200) NOT NULL,\n"
+ " \"type\" VARCHAR(20) NOT NULL,\n"
@@ -85,9 +85,9 @@ public String getRawCreateScript(Table table, boolean baseline) {
+ " \"success\" BOOLEAN NOT NULL DEFAULT FALSE\n"
+ ")"
+ tablespace + ";\n" + "ALTER TABLE "
- + table + " ADD CONSTRAINT \"" + table.getName() + "_pk\" PRIMARY KEY (\"installed_rank\");\n"
+ + table.getName() + " ADD CONSTRAINT \"" + table.getName() + "_pk\" PRIMARY KEY (\"installed_rank\");\n"
+ "CREATE INDEX \""
- + table.getName() + "_s_idx\" ON " + table + " (\"success\");";
+ + table.getName() + "_s_idx\" ON " + table.getName() + " (\"success\");";
}
@Override
@@ -116,15 +116,12 @@ public String getBooleanFalse() {
}
@Override
- public String doQuote(String identifier) {
- return getOpenQuote()
- + StringUtils.replaceAll(identifier, getCloseQuote(), getEscapedQuote())
- + getCloseQuote();
+ protected String doQuote(String identifier) {
+ return pgQuote(identifier);
}
- @Override
- public String getEscapedQuote() {
- return "\"\"";
+ static String pgQuote(String identifier) {
+ return "\"" + StringUtils.replaceAll(identifier, "\"", "\"\"") + "\"";
}
@Override
diff --git a/dinky-admin/src/main/java/org/flywaydb/database/mysql/MySQLDatabase.java b/dinky-admin/src/main/java/org/flywaydb/database/mysql/MySQLDatabase.java
deleted file mode 100644
index 21d32c7464..0000000000
--- a/dinky-admin/src/main/java/org/flywaydb/database/mysql/MySQLDatabase.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-package org.flywaydb.database.mysql;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.flywaydb.core.api.FlywayException;
-import org.flywaydb.core.api.MigrationType;
-import org.flywaydb.core.api.MigrationVersion;
-import org.flywaydb.core.api.configuration.Configuration;
-import org.flywaydb.core.internal.database.base.BaseDatabaseType;
-import org.flywaydb.core.internal.database.base.Database;
-import org.flywaydb.core.internal.database.base.Table;
-import org.flywaydb.core.internal.jdbc.JdbcConnectionFactory;
-import org.flywaydb.core.internal.jdbc.JdbcTemplate;
-import org.flywaydb.core.internal.jdbc.StatementInterceptor;
-import org.flywaydb.database.mysql.mariadb.MariaDBDatabaseType;
-
-import lombok.extern.slf4j.Slf4j;
-
-@Slf4j
-public class MySQLDatabase extends Database {
- // See https://mariadb.com/kb/en/version/
- private static final Pattern MARIADB_VERSION_PATTERN =
- Pattern.compile("(\\d+\\.\\d+)\\.\\d+(-\\d+)*-MariaDB(-\\w+)*");
- private static final Pattern MARIADB_WITH_MAXSCALE_VERSION_PATTERN =
- Pattern.compile("(\\d+\\.\\d+)\\.\\d+(-\\d+)* (\\d+\\.\\d+)\\.\\d+(-\\d+)*-maxscale(-\\w+)*");
- private static final Pattern MYSQL_VERSION_PATTERN = Pattern.compile("(\\d+\\.\\d+)\\.\\d+\\w*");
- /**
- * Whether this is a Percona XtraDB Cluster in strict mode.
- */
- private final boolean pxcStrict;
- /**
- * Whether this database is enforcing GTID consistency.
- */
- private final boolean gtidConsistencyEnforced;
- /**
- * Whether the event scheduler table is queryable.
- */
- final boolean eventSchedulerQueryable;
-
- public MySQLDatabase(
- Configuration configuration,
- JdbcConnectionFactory jdbcConnectionFactory,
- StatementInterceptor statementInterceptor) {
- super(configuration, jdbcConnectionFactory, statementInterceptor);
-
- JdbcTemplate jdbcTemplate = new JdbcTemplate(rawMainJdbcConnection, databaseType);
- pxcStrict = isMySQL() && isRunningInPerconaXtraDBClusterWithStrictMode(jdbcTemplate);
- gtidConsistencyEnforced = isMySQL() && isRunningInGTIDConsistencyMode(jdbcTemplate);
- eventSchedulerQueryable = isMySQL() || isEventSchedulerQueryable(jdbcTemplate);
- }
-
- private static boolean isEventSchedulerQueryable(JdbcTemplate jdbcTemplate) {
- try {
- // Attempt query
- jdbcTemplate.queryForString("SELECT event_name FROM information_schema.events LIMIT 1");
- return true;
- } catch (SQLException e) {
- log.debug("Detected unqueryable MariaDB event scheduler, most likely due to it being OFF or DISABLED.");
- return false;
- }
- }
-
- static boolean isRunningInPerconaXtraDBClusterWithStrictMode(JdbcTemplate jdbcTemplate) {
- try {
- String pcx_strict_mode =
- jdbcTemplate.queryForString("select VARIABLE_VALUE from performance_schema.global_variables"
- + " where variable_name = 'pxc_strict_mode'");
- if ("ENFORCING".equals(pcx_strict_mode) || "MASTER".equals(pcx_strict_mode)) {
- log.debug("Detected Percona XtraDB Cluster in strict mode");
- return true;
- }
- } catch (SQLException e) {
- log.debug("Unable to detect whether we are running in a Percona XtraDB Cluster. Assuming not to be.");
- }
-
- return false;
- }
-
- static boolean isRunningInGTIDConsistencyMode(JdbcTemplate jdbcTemplate) {
- try {
- String gtidConsistency = jdbcTemplate.queryForString("SELECT @@GLOBAL.ENFORCE_GTID_CONSISTENCY");
- if ("ON".equals(gtidConsistency)) {
- log.debug("Detected GTID consistency being enforced");
- return true;
- }
- } catch (SQLException e) {
- log.debug("Unable to detect whether database enforces GTID consistency. Assuming not.");
- }
-
- return false;
- }
-
- boolean isMySQL() {
- return databaseType instanceof MySQLDatabaseType;
- }
-
- boolean isMariaDB() {
- return databaseType instanceof MariaDBDatabaseType;
- }
-
- boolean isPxcStrict() {
- return pxcStrict;
- }
-
- /*
- * CREATE TABLE ... AS SELECT ... cannot be used in three scenarios:
- * - Percona XtraDB Cluster in strict mode doesn't support it
- * - TiDB doesn't support it (overridden elsewhere)
- * - When GTID consistency is being enforced. Note that if GTID_MODE is ON, then ENFORCE_GTID_CONSISTENCY is
- * necessarily ON as well.
- */
- protected boolean isCreateTableAsSelectAllowed() {
- return !pxcStrict && !gtidConsistencyEnforced;
- }
-
- @Override
- public String getRawCreateScript(Table table, boolean baseline) {
- String tablespace =
- configuration.getTablespace() == null ? "" : " TABLESPACE \"" + configuration.getTablespace() + "\"";
-
- String baselineMarker = "";
- if (baseline) {
- if (isCreateTableAsSelectAllowed()) {
- baselineMarker = " AS SELECT" + " 1 as \"installed_rank\","
- + " '"
- + configuration.getBaselineVersion() + "' as \"version\"," + " '"
- + configuration.getBaselineDescription() + "' as \"description\"," + " '"
- + MigrationType.BASELINE + "' as \"type\"," + " '"
- + configuration.getBaselineDescription() + "' as \"script\"," + " NULL as \"checksum\","
- + " '"
- + getInstalledBy() + "' as \"installed_by\"," + " CURRENT_TIMESTAMP as \"installed_on\","
- + " 0 as \"execution_time\","
- + " TRUE as \"success\"\n";
- } else {
- // Revert to regular insert, which unfortunately is not safe in concurrent scenarios
- // due to MySQL implicit commits after DDL statements.
- baselineMarker = ";\n" + getBaselineStatement(table);
- }
- }
-
- return "CREATE TABLE " + table + " (\n" + " `installed_rank` INT NOT NULL,\n"
- + " `version` VARCHAR(50),\n"
- + " `description` VARCHAR(200) NOT NULL,\n"
- + " `type` VARCHAR(20) NOT NULL,\n"
- + " `script` VARCHAR(1000) NOT NULL,\n"
- + " `checksum` INT,\n"
- + " `installed_by` VARCHAR(100) NOT NULL,\n"
- + " `installed_on` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,\n"
- + " `execution_time` INT NOT NULL,\n"
- + " `success` BOOL NOT NULL,\n"
- + " CONSTRAINT "
- + getConstraintName(table.getName()) + " PRIMARY KEY (`installed_rank`)\n" + ")"
- + tablespace + " DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ENGINE=InnoDB" + baselineMarker
- + ";\n"
- + "CREATE INDEX `"
- + table.getName() + "_s_idx` ON " + table + " (`success`);";
- }
-
- protected String getConstraintName(String tableName) {
- return "`" + tableName + "_pk`";
- }
-
- @Override
- protected MySQLConnection doGetConnection(Connection connection) {
- return new MySQLConnection(this, connection);
- }
-
- @Override
- protected MigrationVersion determineVersion() {
- // Ignore the version from the JDBC metadata and use the version returned by the database since proxies such as
- // Azure or ProxySQL return incorrect versions
- String selectVersionOutput = BaseDatabaseType.getSelectVersionOutput(rawMainJdbcConnection);
- if (databaseType instanceof MariaDBDatabaseType) {
- return extractMariaDBVersionFromString(selectVersionOutput);
- }
- return extractMySQLVersionFromString(selectVersionOutput);
- }
-
- static MigrationVersion extractMySQLVersionFromString(String selectVersionOutput) {
- return extractVersionFromString(selectVersionOutput, MYSQL_VERSION_PATTERN);
- }
-
- static MigrationVersion extractMariaDBVersionFromString(String selectVersionOutput) {
- return extractVersionFromString(
- selectVersionOutput, MARIADB_VERSION_PATTERN, MARIADB_WITH_MAXSCALE_VERSION_PATTERN);
- }
-
- /*
- * Given a version string that may contain unwanted text, extract out the version part.
- */
- private static MigrationVersion extractVersionFromString(String versionString, Pattern... patterns) {
- for (Pattern pattern : patterns) {
- Matcher matcher = pattern.matcher(versionString);
- if (matcher.find()) {
- return MigrationVersion.fromVersion(matcher.group(1));
- }
- }
- throw new FlywayException("Unable to determine version from '" + versionString + "'");
- }
-
- @Override
- public final void ensureSupported() {
- if (databaseType.getName().equals("TiDB")) {
- ensureDatabaseIsRecentEnough("5.0");
- recommendFlywayUpgradeIfNecessary("5.0");
- return;
- }
- ensureDatabaseIsRecentEnough("5.1");
- if (databaseType instanceof MariaDBDatabaseType) {
-
- ensureDatabaseNotOlderThanOtherwiseRecommendUpgradeToFlywayEdition(
- "10.2", org.flywaydb.core.internal.license.Edition.ENTERPRISE);
-
- recommendFlywayUpgradeIfNecessary("10.6");
- } else {
- // override Originally it supported at least mysql 8.0, but now it is set to support 5.0 or above.
- ensureDatabaseNotOlderThanOtherwiseRecommendUpgradeToFlywayEdition(
- "5.0", org.flywaydb.core.internal.license.Edition.ENTERPRISE);
-
- recommendFlywayUpgradeIfNecessary("8.0");
- }
- }
-
- @Override
- protected String doGetCurrentUser() throws SQLException {
- return getMainConnection().getJdbcTemplate().queryForString("SELECT SUBSTRING_INDEX(USER(),'@',1)");
- }
-
- @Override
- public boolean supportsDdlTransactions() {
- return false;
- }
-
- @Override
- public boolean supportsChangingCurrentSchema() {
- return true;
- }
-
- @Override
- public String getBooleanTrue() {
- return "1";
- }
-
- @Override
- public String getBooleanFalse() {
- return "0";
- }
-
- @Override
- public String getOpenQuote() {
- return "`";
- }
-
- @Override
- public String getCloseQuote() {
- return "`";
- }
-
- @Override
- public boolean catalogIsSchema() {
- return true;
- }
-
- @Override
- public boolean useSingleConnection() {
- return !pxcStrict;
- }
-}
diff --git a/dinky-admin/src/main/resources/application-flyway.yml b/dinky-admin/src/main/resources/application-flyway.yml
index fe03d6dcf6..50611fcbc9 100644
--- a/dinky-admin/src/main/resources/application-flyway.yml
+++ b/dinky-admin/src/main/resources/application-flyway.yml
@@ -30,4 +30,5 @@ spring:
placeholder-prefix: '##{'
placeholder-suffix: '}##'
fail-on-missing-locations: true # Does the non-existent migration file throw an exception
+ clean-disabled: true
diff --git a/pom.xml b/pom.xml
index 0618a8d974..f9429ac611 100644
--- a/pom.xml
+++ b/pom.xml
@@ -63,7 +63,7 @@
4.1.0
2.0.41
1.18.1
- 10.10.12
+ 7.15.0
32.1.3-jre
1.4.200
1.3
@@ -129,6 +129,11 @@
+
+ org.flywaydb
+ flyway-core
+ ${flyway.version}
+
org.xerial
sqlite-jdbc
diff --git a/script/sql/dinky-pg.sql b/script/sql/dinky-pg.sql
index 0f91a6099c..a3487c7102 100644
--- a/script/sql/dinky-pg.sql
+++ b/script/sql/dinky-pg.sql
@@ -3305,6 +3305,7 @@ CREATE TABLE dinky_metrics
id SERIAL PRIMARY KEY NOT NULL,
task_id INT,
vertices VARCHAR(255),
+ vertices_title VARCHAR(255),
metrics VARCHAR(255),
position INT,
show_type VARCHAR(255),
@@ -3319,6 +3320,7 @@ COMMENT ON TABLE dinky_metrics IS 'metrics layout';
COMMENT ON COLUMN dinky_metrics.id IS 'id';
COMMENT ON COLUMN dinky_metrics.task_id IS 'task id';
COMMENT ON COLUMN dinky_metrics.vertices IS 'vertices';
+COMMENT ON COLUMN dinky_metrics.vertices_title IS 'vertices_title';
COMMENT ON COLUMN dinky_metrics.metrics IS 'metrics';
COMMENT ON COLUMN dinky_metrics.position IS 'position';
COMMENT ON COLUMN dinky_metrics.show_type IS 'show type';
diff --git a/script/sql/upgrade/1.1.0_schema/mysql/dinky_dml.sql b/script/sql/upgrade/1.1.0_schema/mysql/dinky_dml.sql
index 45c2a7e6b4..54423cb218 100644
--- a/script/sql/upgrade/1.1.0_schema/mysql/dinky_dml.sql
+++ b/script/sql/upgrade/1.1.0_schema/mysql/dinky_dml.sql
@@ -18,13 +18,4 @@
*/
-SET NAMES utf8mb4;
-SET FOREIGN_KEY_CHECKS = 0;
-
-begin;
-INSERT INTO `_dinky_flyway_schema_history` (`installed_rank`, `version`, `description`, `type`, `script`, `checksum`,
- `installed_by`, `installed_on`, `execution_time`, `success`)
-VALUES (1, '1.0.2', '<< Flyway Baseline >>', 'BASELINE', '<< Flyway Baseline >>', NULL, 'root', '2024-05-20 01:32:29',
- 0, 1);
-
-commit ;
+INSERT INTO `_dinky_flyway_schema_history` (`installed_rank`, `version`, `description`, `type`, `script`, `checksum`, `installed_by`, `installed_on`, `execution_time`, `success`) VALUES (1, '20240506.1.0.2', 'baseline', 'SQL', 'V20240506.1.0.2__baseline.sql', 1023001974, 'root', '2024-07-08 15:34:05', 61212, 1);
diff --git a/script/sql/upgrade/1.1.0_schema/postgre/dinky_dml.sql b/script/sql/upgrade/1.1.0_schema/postgre/dinky_dml.sql
index f58e7101b8..549df3249e 100644
--- a/script/sql/upgrade/1.1.0_schema/postgre/dinky_dml.sql
+++ b/script/sql/upgrade/1.1.0_schema/postgre/dinky_dml.sql
@@ -21,5 +21,5 @@
INSERT INTO "public"."_dinky_flyway_schema_history" ("installed_rank", "version", "description", "type", "script",
"checksum", "installed_by", "installed_on", "execution_time",
"success")
-VALUES (1, '1.0.2', '<< Flyway Baseline >>', 'BASELINE', '<< Flyway Baseline >>', NULL, 'null',
- '2024-05-17 17:25:43.682212', 0, 't');
\ No newline at end of file
+VALUES (1, '20240506.1.0.2', 'baseline', 'SQL', 'V20240506.1.0.2__baseline.sql', 708291542, 'postgres',
+ '2024-08-28 16:57:25.656355', 1005, 't');
\ No newline at end of file