Unverified Commit 6801c4fc authored by Zzm0809's avatar Zzm0809 Committed by GitHub

[Feature] Support Flyway (#3468)

parent 7fa870fb
...@@ -336,7 +336,14 @@ ...@@ -336,7 +336,14 @@
</exclusion> </exclusion>
</exclusions> </exclusions>
</dependency> </dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-mysql</artifactId>
</dependency>
</dependencies> </dependencies>
<build> <build>
......
/*
*
* 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.dinky.configure;
import java.util.List;
import java.util.Map;
import javax.sql.DataSource;
import org.flywaydb.core.Flyway;
import org.flywaydb.core.api.FlywayException;
import org.flywaydb.core.api.callback.Callback;
import org.flywaydb.core.api.configuration.FluentConfiguration;
import org.flywaydb.core.api.migration.JavaMigration;
import org.springframework.beans.factory.ObjectProvider;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
import org.springframework.boot.autoconfigure.flyway.FlywayConfigurationCustomizer;
import org.springframework.boot.autoconfigure.flyway.FlywayProperties;
import org.springframework.boot.autoconfigure.jdbc.DataSourceProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.context.properties.PropertyMapper;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;
import com.zaxxer.hikari.HikariDataSource;
import cn.hutool.core.lang.Opt;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@Configuration
@DependsOn("dataSource")
@AllArgsConstructor
@EnableAutoConfiguration(exclude = FlywayAutoConfiguration.class)
@EnableConfigurationProperties({FlywayProperties.class, DataSourceProperties.class})
@ConditionalOnProperty(prefix = "spring.flyway", name = "enabled", matchIfMissing = true)
@Slf4j
public class DatabaseFlywayMigration {
private final FlywayProperties flywayProperties;
private final DataSourceProperties dataSourceProperties;
private DataSource dataSource() {
HikariDataSource hikariDataSource = new HikariDataSource();
hikariDataSource.setJdbcUrl(dataSourceProperties.getUrl());
hikariDataSource.setUsername(dataSourceProperties.getUsername());
hikariDataSource.setPassword(dataSourceProperties.getPassword());
Opt.ofBlankAble(dataSourceProperties.getDriverClassName()).ifPresent(hikariDataSource::setDriverClassName);
return hikariDataSource;
}
@Bean
public Flyway flyway(
ObjectProvider<JavaMigration> javaMigrations,
ObjectProvider<Callback> callbacks,
ObjectProvider<FlywayConfigurationCustomizer> fluentConfigurationCustomizers) {
FluentConfiguration fluentConfiguration = Flyway.configure();
fluentConfiguration.dataSource(dataSource());
fluentConfiguration.javaMigrations(javaMigrations.stream().toArray(JavaMigration[]::new));
fluentConfiguration.callbacks(callbacks.orderedStream().toArray(Callback[]::new));
fluentConfigurationCustomizers
.orderedStream()
.forEach((customizer) -> customizer.customize(fluentConfiguration));
configureProperties(fluentConfiguration, flywayProperties);
Flyway flyway = fluentConfiguration.load();
// use flyway to migrate database schema
executeMigrate(flyway);
return flyway;
}
/**
* execute migrate method
* @param flyway flyway
*/
private static void executeMigrate(Flyway flyway) {
try {
log.info("===========[Initialize flyway start]============");
flyway.migrate();
log.info("===========[Initialize flyway successfully ]============");
} catch (FlywayException e) {
flyway.repair();
log.error("===========[Failed to initialize flyway]============");
throw e;
} finally {
HikariDataSource dataSource =
(HikariDataSource) flyway.getConfiguration().getDataSource();
dataSource.close();
log.info("===========[Close dataSource of flyway successfully]============");
}
}
private void configureProperties(FluentConfiguration configuration, FlywayProperties properties) {
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
String[] locations = properties.getLocations().toArray(new String[0]);
map.from(locations).to(configuration::locations);
map.from(properties.getEncoding()).to(configuration::encoding);
map.from(properties.getConnectRetries()).to(configuration::connectRetries);
// No method reference for compatibility with Flyway 6.x
map.from(properties.getLockRetryCount()).to(configuration::lockRetryCount);
// No method reference for compatibility with Flyway 5.x
map.from(properties.getDefaultSchema()).to(configuration::defaultSchema);
map.from(properties.getSchemas()).as(StringUtils::toStringArray).to(configuration::schemas);
map.from(properties.isCreateSchemas()).to(configuration::createSchemas);
map.from(properties.getTable()).to(configuration::table);
// No method reference for compatibility with Flyway 5.x
map.from(properties.getTablespace()).to(configuration::tablespace);
map.from(properties.getBaselineDescription()).to(configuration::baselineDescription);
map.from(properties.getBaselineVersion()).to(configuration::baselineVersion);
map.from(properties.getInstalledBy()).to(configuration::installedBy);
map.from(properties.getPlaceholders()).to(configuration::placeholders);
map.from(properties.getPlaceholderPrefix()).to(configuration::placeholderPrefix);
map.from(properties.getPlaceholderSuffix()).to(configuration::placeholderSuffix);
map.from(properties.isPlaceholderReplacement()).to(configuration::placeholderReplacement);
map.from(properties.getSqlMigrationPrefix()).to(configuration::sqlMigrationPrefix);
map.from(properties.getSqlMigrationSuffixes())
.as(StringUtils::toStringArray)
.to(configuration::sqlMigrationSuffixes);
map.from(properties.getSqlMigrationSeparator()).to(configuration::sqlMigrationSeparator);
map.from(properties.getRepeatableSqlMigrationPrefix()).to(configuration::repeatableSqlMigrationPrefix);
map.from(properties.getTarget()).to(configuration::target);
map.from(properties.isBaselineOnMigrate()).to(configuration::baselineOnMigrate);
map.from(properties.isCleanDisabled()).to(configuration::cleanDisabled);
map.from(properties.isCleanOnValidationError()).to(configuration::cleanOnValidationError);
map.from(properties.isGroup()).to(configuration::group);
map.from(properties.isMixed()).to(configuration::mixed);
map.from(properties.isOutOfOrder()).to(configuration::outOfOrder);
map.from(properties.isSkipDefaultCallbacks()).to(configuration::skipDefaultCallbacks);
map.from(properties.isSkipDefaultResolvers()).to(configuration::skipDefaultResolvers);
map.from(properties.isValidateOnMigrate()).to(configuration::validateOnMigrate);
map.from(properties.getInitSqls())
.whenNot(CollectionUtils::isEmpty)
.as((initSqls) -> StringUtils.collectionToDelimitedString(initSqls, "\n"))
.to(configuration::initSql);
// Pro properties
map.from(properties.getBatch()).to(configuration::batch);
map.from(properties.getDryRunOutput()).to(configuration::dryRunOutput);
map.from(properties.getErrorOverrides()).to(configuration::errorOverrides);
map.from(properties.getLicenseKey()).to(configuration::licenseKey);
map.from(properties.getOracleSqlplus()).to(configuration::oracleSqlplus);
// No method reference for compatibility with Flyway 5.x
map.from(properties.getOracleSqlplusWarn()).to(configuration::oracleSqlplusWarn);
map.from(properties.getStream()).to(configuration::stream);
map.from(properties.getUndoSqlMigrationPrefix()).to(configuration::undoSqlMigrationPrefix);
// No method reference for compatibility with Flyway 6.x
map.from(properties.getCherryPick()).to(configuration::cherryPick);
// No method reference for compatibility with Flyway 6.x
map.from(properties.getJdbcProperties()).whenNot(Map::isEmpty).to(configuration::jdbcProperties);
// No method reference for compatibility with Flyway 6.x
map.from(properties.getOracleKerberosCacheFile()).to(configuration::oracleKerberosCacheFile);
// No method reference for compatibility with Flyway 6.x
map.from(properties.getOutputQueryResults()).to(configuration::outputQueryResults);
// No method reference for compatibility with Flyway 6.x
map.from(properties.getSkipExecutingMigrations()).to(configuration::skipExecutingMigrations);
// No method reference for compatibility with Flyway < 7.8
map.from(properties.getIgnoreMigrationPatterns())
.whenNot(List::isEmpty)
.to((ignoreMigrationPatterns) ->
configuration.ignoreMigrationPatterns(ignoreMigrationPatterns.toArray(new String[0])));
// No method reference for compatibility with Flyway version < 7.9
map.from(properties.getDetectEncoding()).to(configuration::detectEncoding);
}
}
/*
*
* 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<MySQLConnection> {
// 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 + " 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;
}
}
/*
*
* 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.springframework.jdbc.datasource.init;
import java.sql.Connection;
import javax.sql.DataSource;
import org.springframework.dao.DataAccessException;
import org.springframework.jdbc.datasource.DataSourceUtils;
import org.springframework.util.Assert;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.db.Db;
/**
* Utility methods for executing a {@link DatabasePopulator}.
*
* @author Juergen Hoeller
* @author Oliver Gierke
* @author Sam Brannen
* @since 3.1
*/
public abstract class DatabasePopulatorUtils {
private static boolean isInit = true;
/**
* Execute the given {@link DatabasePopulator} against the given {@link DataSource}.
* <p>As of Spring Framework 5.3.11, the {@link Connection} for the supplied
* {@code DataSource} will be {@linkplain Connection#commit() committed} if
* it is not configured for {@link Connection#getAutoCommit() auto-commit} and
* is not {@linkplain DataSourceUtils#isConnectionTransactional transactional}.
*
* @param populator the {@code DatabasePopulator} to execute
* @param dataSource the {@code DataSource} to execute against
* @throws DataAccessException if an error occurs, specifically a {@link ScriptException}
* @see DataSourceUtils#isConnectionTransactional(Connection, DataSource)
*/
public static void execute(DatabasePopulator populator, DataSource dataSource) throws DataAccessException {
Assert.notNull(populator, "DatabasePopulator must not be null");
Assert.notNull(dataSource, "DataSource must not be null");
try {
// Override this method and do not run it if the table exists(重写此方法,如果有表存在,则不运行)
if (isInit && CollUtil.isNotEmpty(Db.use(dataSource).query("show tables"))) {
return;
}
isInit = false;
Connection connection = DataSourceUtils.getConnection(dataSource);
try {
populator.populate(connection);
if (!connection.getAutoCommit() && !DataSourceUtils.isConnectionTransactional(connection, dataSource)) {
connection.commit();
}
} finally {
DataSourceUtils.releaseConnection(connection, dataSource);
}
} catch (ScriptException ex) {
throw ex;
} catch (Throwable ex) {
throw new UncategorizedScriptException("Failed to execute database script", ex);
}
}
}
#
# 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
#
# https://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.
#
spring:
flyway:
enabled: true # Is it enabled
group: true # Enable grouping
locations:
- classpath:db/migration/${spring.profiles.active}
table: _dinky_flyway_schema_history
placeholder-replacement: false # Placeholder Replacement
baseline-on-migrate: true # Baseline during migration
baseline-version: 1.0.2 # Baseline version
validate-on-migrate: false # Verify during migration
placeholder-prefix: '##{'
placeholder-suffix: '}##'
fail-on-missing-locations: true # Does the non-existent migration file throw an exception
...@@ -27,9 +27,4 @@ spring: ...@@ -27,9 +27,4 @@ spring:
h2: h2:
console: console:
enabled: true enabled: true
path: /api/h2 path: /api/h2
sql: \ No newline at end of file
init:
schema-locations: classpath:db/db-h2-ddl.sql
data-locations: classpath:db/db-h2-dml.sql
mode: always
\ No newline at end of file
...@@ -17,7 +17,9 @@ spring: ...@@ -17,7 +17,9 @@ spring:
# If you use the h2 database, please configure the h2 database connection information in application-h2.yml, # If you use the h2 database, please configure the h2 database connection information in application-h2.yml,
# note: the h2 database is only for experience use, and the related data that has been created cannot be migrated, please use it with caution # note: the h2 database is only for experience use, and the related data that has been created cannot be migrated, please use it with caution
active: ${DB_ACTIVE:h2} #[h2,mysql,pgsql] active: ${DB_ACTIVE:h2} #[h2,mysql,pgsql]
include: jmx include:
- jmx
- flyway
lifecycle: lifecycle:
timeout-per-shutdown-phase: 30s timeout-per-shutdown-phase: 30s
......
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
CREATE TABLE `dinky_alert_group` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`name` varchar(50) NOT null COMMENT 'alert group name',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`alert_instance_ids` text null COMMENT 'Alert instance IDS',
`note` varchar(255) null DEFAULT null COMMENT 'note',
`enabled` tinyint(4) null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_alert_history` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`alert_group_id` int(11) null DEFAULT null COMMENT 'Alert group ID',
`job_instance_id` int(11) null DEFAULT null COMMENT 'job instance ID',
`title` varchar(255) null DEFAULT null COMMENT 'alert title',
`content` text null COMMENT 'content description',
`status` int(11) null DEFAULT null COMMENT 'alert status',
`log` text null COMMENT 'log',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_alert_instance` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`name` varchar(50) NOT null COMMENT 'alert instance name',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`type` varchar(50) null DEFAULT null COMMENT 'alert instance type such as: DingTalk,Wechat(Webhook,app) Feishu ,email',
`params` longtext null COMMENT 'configuration',
`enabled` tinyint(4) null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT 1 COMMENT 'creator',
`updater` int(11) null DEFAULT 1 COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_catalogue` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`task_id` int(11) null DEFAULT null COMMENT 'Job ID',
`name` varchar(100) NOT null COMMENT 'Job Name',
`type` varchar(50) null DEFAULT null COMMENT 'Job Type',
`parent_id` int(11) NOT null DEFAULT 0 COMMENT 'parent ID',
`enabled` tinyint(1) NOT null DEFAULT 1 COMMENT 'is enable',
`is_leaf` tinyint(1) NOT null COMMENT 'is leaf node',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_cluster` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`name` varchar(255) NOT null COMMENT 'cluster instance name',
`alias` varchar(255) null DEFAULT null COMMENT 'cluster instance alias',
`type` varchar(50) null DEFAULT null COMMENT 'cluster types',
`hosts` text null COMMENT 'cluster hosts',
`job_manager_host` varchar(255) null DEFAULT null COMMENT 'Job Manager Host',
`version` varchar(20) null DEFAULT null COMMENT 'version',
`status` int(11) null DEFAULT null COMMENT 'cluster status',
`note` varchar(255) null DEFAULT null COMMENT 'note',
`auto_registers` tinyint(1) null DEFAULT 0 COMMENT 'is auto registration',
`cluster_configuration_id` int(11) null DEFAULT null COMMENT 'cluster configuration id',
`task_id` int(11) null DEFAULT null COMMENT 'task ID',
`enabled` tinyint(1) NOT null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_cluster_configuration` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`name` varchar(255) NOT null COMMENT 'cluster configuration name',
`type` varchar(50) null DEFAULT null COMMENT 'cluster type',
`config_json` text null COMMENT 'json of configuration',
`is_available` tinyint(1) NOT null DEFAULT 0 COMMENT 'is available',
`note` varchar(255) null DEFAULT null COMMENT 'note',
`enabled` tinyint(1) NOT null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_database` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`name` varchar(30) NOT null COMMENT 'database name',
`group_name` varchar(255) null DEFAULT 'Default' COMMENT 'database belong group name',
`type` varchar(50) NOT null COMMENT 'database type',
`connect_config` text NOT null COMMENT 'database type',
`note` varchar(255) null DEFAULT null COMMENT 'note',
`flink_config` text null COMMENT 'Flink configuration',
`flink_template` text null COMMENT 'Flink template',
`db_version` varchar(255) null DEFAULT null COMMENT 'version,such as: 11g of oracle ,2.2.3 of hbase',
`status` tinyint(1) null DEFAULT null COMMENT 'heartbeat status',
`health_time` datetime(0) null DEFAULT null COMMENT 'last heartbeat time of trigger',
`heartbeat_time` datetime(0) null DEFAULT null COMMENT 'last heartbeat time',
`enabled` tinyint(1) NOT null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_flink_document` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`category` varchar(255) null DEFAULT null COMMENT 'document category',
`type` varchar(255) null DEFAULT null COMMENT 'document type',
`subtype` varchar(255) null DEFAULT null COMMENT 'document subtype',
`name` varchar(255) null DEFAULT null COMMENT 'document name',
`description` longtext null,
`fill_value` longtext null COMMENT 'fill value',
`version` varchar(255) null DEFAULT null COMMENT 'document version such as:(flink1.12,flink1.13,flink1.14,flink1.15)',
`like_num` int(11) null DEFAULT 0 COMMENT 'like number',
`enabled` tinyint(1) NOT null DEFAULT 0 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update_time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_fragment` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`name` varchar(50) NOT null COMMENT 'fragment name',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`fragment_value` text NOT null COMMENT 'fragment value',
`note` text null COMMENT 'note',
`enabled` tinyint(4) null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_history` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`cluster_id` int(11) NOT null DEFAULT 0 COMMENT 'cluster ID',
`cluster_configuration_id` int(11) null DEFAULT null COMMENT 'cluster configuration id',
`session` varchar(255) null DEFAULT null COMMENT 'session',
`job_id` varchar(255) null DEFAULT null COMMENT 'Job ID',
`job_name` varchar(255) null DEFAULT null COMMENT 'Job Name',
`job_manager_address` varchar(255) null DEFAULT null COMMENT 'JJobManager Address',
`batch_model` boolean null DEFAULT false COMMENT 'is batch model',
`status` int(11) NOT null DEFAULT 0 COMMENT 'status',
`type` varchar(50) null DEFAULT null COMMENT 'job type',
`statement` text null COMMENT 'statement set',
`error` text null COMMENT 'error message',
`result` text null COMMENT 'result set',
`config_json` text null COMMENT 'config json',
`start_time` datetime(0) null DEFAULT null COMMENT 'job start time',
`end_time` datetime(0) null DEFAULT null COMMENT 'job end time',
`task_id` int(11) null DEFAULT null COMMENT 'task ID'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_job_history` (
`id` int(11) NOT null COMMENT 'id',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`job_json` text null COMMENT 'Job information json',
`exceptions_json` text null COMMENT 'error message json',
`checkpoints_json` text null COMMENT 'checkpoints json',
`checkpoints_config_json` text null COMMENT 'checkpoints configuration json',
`config_json` text null COMMENT 'configuration',
`cluster_json` text null COMMENT 'cluster instance configuration',
`cluster_configuration_json` text null COMMENT 'cluster config',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_job_instance` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`name` varchar(255) null DEFAULT null COMMENT 'job instance name',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`task_id` int(11) null DEFAULT null COMMENT 'task ID',
`step` int(11) null DEFAULT null COMMENT 'job lifecycle',
`cluster_id` int(11) null DEFAULT null COMMENT 'cluster ID',
`jid` varchar(50) null DEFAULT null COMMENT 'Flink JobId',
`status` varchar(50) null DEFAULT null COMMENT 'job instance status',
`history_id` int(11) null DEFAULT null COMMENT 'execution history ID',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`finish_time` datetime(0) null DEFAULT null COMMENT 'finish time',
`duration` bigint(20) null DEFAULT null COMMENT 'job duration',
`error` text null COMMENT 'error logs',
`failed_restart_count` int(11) null DEFAULT null COMMENT 'failed restart count',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater',
`operator` int(11) null DEFAULT null COMMENT 'operator'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_role` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_id` int(11) NOT null COMMENT 'tenant id',
`role_code` varchar(64) NOT null COMMENT 'role code',
`role_name` varchar(64) NOT null COMMENT 'role name',
`is_delete` tinyint(1) NOT null DEFAULT 0 COMMENT 'is delete',
`note` varchar(255) null DEFAULT null COMMENT 'note',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_savepoints` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`task_id` int(11) NOT null COMMENT 'task ID',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`name` varchar(255) NOT null COMMENT 'task name',
`type` varchar(255) NOT null COMMENT 'savepoint type',
`path` varchar(255) NOT null COMMENT 'savepoint path',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`creator` int(11) null DEFAULT null COMMENT 'creator'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_sys_config` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`name` varchar(255) NOT null COMMENT 'configuration name',
`value` text null COMMENT 'configuration value',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_task` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`name` varchar(255) NOT null COMMENT 'Job name',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`dialect` varchar(50) null DEFAULT null COMMENT 'dialect',
`type` varchar(50) null DEFAULT null COMMENT 'Job type',
`check_point` int(11) null DEFAULT null COMMENT 'CheckPoint trigger seconds',
`save_point_strategy` int(11) null DEFAULT null COMMENT 'SavePoint strategy',
`save_point_path` varchar(255) null DEFAULT null COMMENT 'SavePointPath',
`parallelism` int(11) null DEFAULT null COMMENT 'parallelism',
`fragment` tinyint(1) null DEFAULT 0 COMMENT 'fragment',
`statement_set` tinyint(1) null DEFAULT 0 COMMENT 'enable statement set',
`batch_model` tinyint(1) null DEFAULT 0 COMMENT 'use batch model',
`cluster_id` int(11) null DEFAULT null COMMENT 'Flink cluster ID',
`cluster_configuration_id` int(11) null DEFAULT null COMMENT 'cluster configuration ID',
`database_id` int(11) null DEFAULT null COMMENT 'database ID',
`env_id` int(11) null DEFAULT null COMMENT 'env id',
`alert_group_id` bigint(20) null DEFAULT null COMMENT 'alert group id',
`config_json` text null COMMENT 'configuration json',
`note` varchar(255) null DEFAULT null COMMENT 'Job Note',
`step` int(11) null DEFAULT 1 COMMENT 'Job lifecycle',
`job_instance_id` bigint(20) null DEFAULT null COMMENT 'job instance id',
`enabled` tinyint(1) NOT null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`version_id` int(11) null DEFAULT null COMMENT 'version id',
`statement` text null DEFAULT null COMMENT 'statement',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater',
`operator` int(11) null DEFAULT null COMMENT 'operator',
`first_level_owner` int(11) DEFAULT NULL COMMENT 'primary responsible person id',
`second_level_owners` varchar(128) DEFAULT NULL COMMENT 'list of secondary responsible persons ids'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_task_version` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`task_id` int(11) NOT null COMMENT 'task ID ',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`version_id` int(11) NOT null COMMENT 'version ID ',
`statement` text null COMMENT 'flink sql statement',
`name` varchar(255) NOT null COMMENT 'version name',
`dialect` varchar(50) null DEFAULT null COMMENT 'dialect',
`type` varchar(50) null DEFAULT null COMMENT 'type',
`task_configure` text NOT null COMMENT 'task configuration',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`creator` int(11) null DEFAULT null COMMENT 'creator'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_tenant` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_code` varchar(64) NOT null COMMENT 'tenant code',
`is_delete` tinyint(1) NOT null DEFAULT 0 COMMENT 'is delete',
`note` varchar(255) null DEFAULT null COMMENT 'note',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_udf_template` (
`id` int(11) NOT null AUTO_INCREMENT,
`name` varchar(100) null DEFAULT null COMMENT 'template name',
`code_type` varchar(10) null DEFAULT null COMMENT 'code type',
`function_type` varchar(10) null DEFAULT null COMMENT 'function type',
`template_code` longtext null COMMENT 'code',
`enabled` tinyint(1) not null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime DEFAULT null ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_user` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`username` varchar(50) NOT null COMMENT 'username',
`user_type` int DEFAULT 0 NOT null COMMENT 'login type (0:LOCAL,1:LDAP)',
`password` varchar(50) null DEFAULT null COMMENT 'password',
`nickname` varchar(50) null DEFAULT null COMMENT 'nickname',
`worknum` varchar(50) null DEFAULT null COMMENT 'worknum',
`avatar` blob null COMMENT 'avatar',
`mobile` varchar(20) null DEFAULT null COMMENT 'mobile phone',
`enabled` tinyint(1) NOT null DEFAULT 1 COMMENT 'is enable',
`super_admin_flag` tinyint(1) DEFAULT '0' COMMENT 'is super admin(0:false,1true)',
`is_delete` tinyint(1) NOT null DEFAULT 0 COMMENT 'is delete',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_user_role` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`user_id` int(11) NOT null COMMENT 'user id',
`role_id` int(11) NOT null COMMENT 'role id',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `dinky_user_tenant` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`user_id` int(11) NOT null COMMENT 'user id',
`tenant_id` int(11) NOT null COMMENT 'tenant id',
`tenant_admin_flag` tinyint DEFAULT '0' COMMENT 'tenant admin flag(0:false,1:true)',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `metadata_column` (
`column_name` varchar(255) NOT null COMMENT 'column name',
`column_type` varchar(255) NOT null COMMENT 'column type, such as : Physical , Metadata , Computed , WATERMARK',
`data_type` varchar(255) NOT null COMMENT 'data type',
`expr` varchar(255) null DEFAULT null COMMENT 'expression',
`description` varchar(255) NOT null COMMENT 'column description',
`table_id` int(11) NOT null COMMENT 'table id',
`primary` bit(1) null DEFAULT null COMMENT 'table primary key',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`create_time` datetime(0) NOT null DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'create time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `metadata_database` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`database_name` varchar(255) NOT null COMMENT 'database name',
`description` varchar(255) null DEFAULT null COMMENT 'database description',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`create_time` datetime(0) null DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'create time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `metadata_database_property` (
`key` varchar(255) NOT null COMMENT 'key',
`value` varchar(255) null DEFAULT null COMMENT 'value',
`database_id` int(11) NOT null COMMENT 'database id',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`create_time` datetime(0) NOT null DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'create time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `metadata_function` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT '主键',
`function_name` varchar(255) NOT null COMMENT 'function name',
`class_name` varchar(255) NOT null COMMENT 'class name',
`database_id` int(11) NOT null COMMENT 'database id',
`function_language` varchar(255) null DEFAULT null COMMENT 'function language',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`create_time` datetime(0) null DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'create time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `metadata_table` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT '主键',
`table_name` varchar(255) NOT null COMMENT 'table name',
`table_type` varchar(255) NOT null COMMENT 'type,such as:database,table,view',
`database_id` int(11) NOT null COMMENT 'database id',
`description` varchar(255) null DEFAULT null COMMENT 'table description',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`create_time` datetime(0) null DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'create time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE `metadata_table_property` (
`key` varchar(255) NOT null COMMENT 'key',
`value` mediumtext null COMMENT 'value',
`table_id` int(11) NOT null COMMENT 'table id',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`create_time` datetime(0) NOT null DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'create tiime'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of metadata_table_property
-- ----------------------------
-- ----------------------------
-- Table structure for dinky_row_permissions
-- ----------------------------
CREATE TABLE dinky_row_permissions (
id int PRIMARY KEY AUTO_INCREMENT COMMENT 'ID',
role_id int NOT null COMMENT '角色ID',
table_name varchar(255) null COMMENT '表名',
expression varchar(255) null COMMENT '表达式',
create_time datetime null COMMENT '创建时间',
update_time datetime null COMMENT '更新时间',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
);
SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE `dinky_git_project` (
`id` bigint(20) NOT null AUTO_INCREMENT,
`tenant_id` bigint(20) NOT null,
`name` varchar(255) NOT null,
`url` varchar(1000) NOT null,
`branch` varchar(1000) NOT null,
`username` varchar(255) DEFAULT null,
`password` varchar(255) DEFAULT null,
`private_key` varchar(255) DEFAULT null COMMENT 'keypath',
`pom` varchar(255) DEFAULT null,
`build_args` varchar(255) DEFAULT null,
`code_type` tinyint(4) DEFAULT null COMMENT 'code type(1-java,2-python)',
`type` tinyint(4) NOT null COMMENT '1-http ,2-ssh',
`last_build` datetime DEFAULT null,
`description` varchar(255) DEFAULT null,
`build_state` tinyint(2) NOT null DEFAULT '0' COMMENT '0-notStart 1-process 2-failed 3-success',
`build_step` tinyint(2) NOT null DEFAULT '0',
`enabled` tinyint(1) NOT null DEFAULT '1' COMMENT '0-disable 1-enable',
`udf_class_map_list` text COMMENT 'scan udf class',
`order_line` int(11) NOT null DEFAULT '1' COMMENT 'order',
`create_time` datetime NOT null DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`update_time` datetime NOT null DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater',
`operator` int(11) null DEFAULT null COMMENT 'operator'
) ENGINE = InnoDB;
CREATE TABLE `dinky_metrics` (
`id` int(11) NOT null AUTO_INCREMENT,
`task_id` int(255) DEFAULT null,
`vertices` varchar(255) DEFAULT null,
`metrics` varchar(255) DEFAULT null,
`position` int(11) DEFAULT null,
`show_type` varchar(255) DEFAULT null,
`show_size` varchar(255) DEFAULT null,
`title` CLOB DEFAULT null,
`layout_name` varchar(255) DEFAULT null,
`create_time` datetime DEFAULT null,
`update_time` datetime DEFAULT null
) ENGINE = InnoDB;
CREATE TABLE `dinky_resources` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'key',
`file_name` varchar(64) DEFAULT null COMMENT 'file name',
`description` varchar(255) DEFAULT null,
`user_id` int(11) DEFAULT null COMMENT 'user id',
`type` tinyint(4) DEFAULT null COMMENT 'resource type,0:FILE,1:UDF',
`size` bigint(20) DEFAULT null COMMENT 'resource size',
`pid` int(11) DEFAULT null,
`full_name` text DEFAULT null,
`is_directory` tinyint(4) DEFAULT null,
`create_time` datetime NOT null DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`update_time` datetime NOT null DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB;
-- ----------------------------
-- Table structure for dinky_sys_login_log
-- ----------------------------
CREATE TABLE `dinky_sys_login_log` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'key',
`user_id` int(11) NOT null COMMENT 'user id',
`username` varchar(60) NOT null COMMENT 'username',
`login_type` int NOT null COMMENT 'login type(0:LOCAL,1:LDAP)',
`ip` varchar(40) NOT null COMMENT 'ip addr',
`status` int NOT null COMMENT 'login status',
`msg` text NOT null COMMENT 'status msg',
`create_time` datetime NOT null COMMENT 'create time',
`access_time` datetime DEFAULT null COMMENT 'access time',
`update_time` datetime NOT null,
`is_deleted` tinyint(1) NOT null DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ----------------------------
-- Table structure for dinky_sys_operate_log
-- ----------------------------
CREATE TABLE `dinky_sys_operate_log` (
`id` bigint NOT null AUTO_INCREMENT COMMENT 'id',
`module_name` varchar(50) DEFAULT '' COMMENT 'module name',
`business_type` int null DEFAULT 0 COMMENT 'business type',
`method` varchar(100) null DEFAULT '' COMMENT 'method name',
`request_method` varchar(10) null DEFAULT '' COMMENT 'request method',
`operate_name` varchar(50) DEFAULT '' COMMENT 'operate name',
`operate_user_id` int NOT null COMMENT 'operate user id',
`operate_url` varchar(255) DEFAULT '' COMMENT 'operate url',
`operate_ip` varchar(50) DEFAULT '' COMMENT 'ip',
`operate_location` varchar(255) DEFAULT '' COMMENT 'operate location',
`operate_param` longtext DEFAULT '' COMMENT 'request param',
`json_result` longtext DEFAULT null COMMENT 'return json result',
`status` int null DEFAULT null COMMENT 'operate status',
`error_msg` longtext DEFAULT null COMMENT 'error msg',
`operate_time` datetime(0) DEFAULT null COMMENT 'operate time',
PRIMARY KEY (`id`)
) ENGINE = InnoDB;
-- ----------------------------
-- Table structure for dinky_sys_menu
-- ----------------------------
create table `dinky_sys_menu` (
`id` bigint not null auto_increment comment ' id',
`parent_id` bigint not null comment 'parent menu id',
`name` varchar(64) not null comment 'menu button name',
`path` varchar(64) default null comment 'routing path',
`component` varchar(64) default null comment 'routing component component',
`perms` varchar(64) default null comment 'authority id',
`icon` varchar(64) default null comment 'icon',
`type` char(1) default null comment 'type(M:directory C:menu F:button)',
`display` tinyint default 1 comment 'whether the menu is displayed',
`order_num` int default null comment 'sort',
`create_time` datetime not null default current_timestamp comment 'create time',
`update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time',
`note` varchar(255) default null comment 'note',
primary key (`id`)
) engine=innodb ;
-- ----------------------------
-- Table structure dinky_sys_role_menu
-- ----------------------------
CREATE TABLE `dinky_sys_role_menu` (
`id` bigint NOT null AUTO_INCREMENT COMMENT 'id',
`role_id` bigint NOT null COMMENT 'role id',
`menu_id` bigint NOT null COMMENT 'menu id',
`create_time` datetime not null default current_timestamp comment 'create time',
`update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time',
PRIMARY KEY (`id`),
UNIQUE KEY `un_role_menu_inx` (`role_id`,`menu_id`)
) ENGINE=InnoDB ;
-- ----------------------------
-- Table structure updater
-- ----------------------------
CREATE TABLE `dinky_sys_token` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`token_value` varchar(255) NOT NULL COMMENT 'token value',
`user_id` bigint NOT NULL COMMENT 'user id',
`role_id` bigint NOT NULL COMMENT 'role id',
`tenant_id` bigint NOT NULL COMMENT 'tenant id',
`expire_type` tinyint NOT NULL COMMENT '1: never expire, 2: expire after a period of time, 3: expire at a certain time',
`expire_start_time` datetime DEFAULT NULL COMMENT 'expire start time ,when expire_type = 3 , it is the start time of the period',
`expire_end_time` datetime DEFAULT NULL COMMENT 'expire end time ,when expire_type = 2,3 , it is the end time of the period',
`create_time` datetime NOT NULL COMMENT 'create time',
`update_time` datetime NOT NULL COMMENT 'modify time',
`source` tinyint(2) DEFAULT NULL COMMENT '1:login 2:custom',
`creator` bigint DEFAULT NULL COMMENT 'creator',
`updater` bigint DEFAULT NULL COMMENT 'updater',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COMMENT='token management';
-- ----------------------------
-- Table structure dinky_sys_alert
-- ----------------------------
create table if not exists dinky_alert_template
(
id int auto_increment
primary key COMMENT 'id',
name varchar(20) COMMENT 'template name',
template_content text null COMMENT 'template content',
enabled tinyint default 1 null COMMENT 'is enable',
create_time datetime null COMMENT 'create time',
update_time datetime null COMMENT 'update time',
`creator` bigint DEFAULT NULL COMMENT 'creator',
`updater` bigint DEFAULT NULL COMMENT 'updater'
);
create table if not exists dinky_alert_rules
(
id int auto_increment
primary key comment 'id',
name varchar(40) unique not null comment 'rule name',
rule text null comment 'specify rule',
template_id int null comment 'template id',
rule_type varchar(10) null comment 'alert rule type',
trigger_conditions varchar(20) null comment 'trigger conditions',
description text null comment 'description',
enabled tinyint default 1 null comment 'is enable',
create_time datetime null comment 'create time',
update_time datetime null comment 'update time',
`creator` bigint DEFAULT NULL COMMENT 'creator',
`updater` bigint DEFAULT NULL COMMENT 'updater'
);
CREATE TABLE IF NOT EXISTS `dinky_udf_manage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL COMMENT 'udf name',
`class_name` varchar(50) DEFAULT NULL COMMENT 'Complete class name',
`task_id` int(11) DEFAULT NULL COMMENT 'task id',
`resources_id` int(11) DEFAULT NULL COMMENT 'resources id',
`enabled` tinyint(1) DEFAULT 1 COMMENT 'is enable',
`create_time` datetime DEFAULT NULL COMMENT 'create time',
`update_time` datetime DEFAULT NULL COMMENT 'update time',
`creator` bigint DEFAULT NULL COMMENT 'creator',
`updater` bigint DEFAULT NULL COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
# Chinese
## 前置要求
- 数据库版本: MySQL 5.7+
- 必须有 mysql/postgresql 连接包
## 数据库脚本规则
- V 开头的代表发布版本; 规则: `V{版本号}__{描述}.sql`
- R 开头的代表回滚版本; 规则: `R{版本号}__{描述}.sql`
## 命名规则
- V{版本号}_{描述}.sql eg: V1.0.2__modify-ddl.sql
- R{版本号}_{描述}.sql eg: R1.0.2__modify-ddl.sql
**注意:**
- V{版本号}__{描述}.sql 中间是两个下划线,固定规则,不符合规则将无法执行
- 每个版本只能有一个 V{版本号}__{描述}.sql 文件,否则将无法执行, 不管是 DDL 还是 DML 统一放在一个文件中
# English
## Pre requirements
- Database version: MySQL 5.7+
- Must have MySQL/postgreSQL connection package
## Database Script Rules
- V represents the released version; Rule: `V{Version Number}__{Description}.SQL`
- R represents the rolled back version; Rule: `R{Version Number}__{Description}.SQL`
## Naming rules
- V {version number} _ {description}. SQL eg: V1.0.2_modify ddl. SQL
- R {version number} _ {description}. SQL eg: R1.0.2_modify ddl. SQL
**Attention:**
- V{version number}__{description}.SQL has two underscores in the middle, which are fixed rules. If they do not comply with the rules, they cannot be executed
- Each version can only have one V {version number} _ {description}. SQL file, otherwise it will not be executed, whether it is DDL or DML, it will be placed in one file
\ No newline at end of file
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
CREATE TABLE IF NOT EXISTS `dinky_alert_group` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`name` varchar(50) NOT null COMMENT 'alert group name',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`alert_instance_ids` text null COMMENT 'Alert instance IDS',
`note` varchar(255) null DEFAULT null COMMENT 'note',
`enabled` tinyint(4) null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_alert_history` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`alert_group_id` int(11) null DEFAULT null COMMENT 'Alert group ID',
`job_instance_id` int(11) null DEFAULT null COMMENT 'job instance ID',
`title` varchar(255) null DEFAULT null COMMENT 'alert title',
`content` text null COMMENT 'content description',
`status` int(11) null DEFAULT null COMMENT 'alert status',
`log` text null COMMENT 'log',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_alert_instance` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`name` varchar(50) NOT null COMMENT 'alert instance name',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`type` varchar(50) null DEFAULT null COMMENT 'alert instance type such as: DingTalk,Wechat(Webhook,app) Feishu ,email',
`params` longtext null COMMENT 'configuration',
`enabled` tinyint(4) null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT 1 COMMENT 'creator',
`updater` int(11) null DEFAULT 1 COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_catalogue` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`task_id` int(11) null DEFAULT null COMMENT 'Job ID',
`name` varchar(100) NOT null COMMENT 'Job Name',
`type` varchar(50) null DEFAULT null COMMENT 'Job Type',
`parent_id` int(11) NOT null DEFAULT 0 COMMENT 'parent ID',
`enabled` tinyint(1) NOT null DEFAULT 1 COMMENT 'is enable',
`is_leaf` tinyint(1) NOT null COMMENT 'is leaf node',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_cluster` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`name` varchar(255) NOT null COMMENT 'cluster instance name',
`alias` varchar(255) null DEFAULT null COMMENT 'cluster instance alias',
`type` varchar(50) null DEFAULT null COMMENT 'cluster types',
`hosts` text null COMMENT 'cluster hosts',
`job_manager_host` varchar(255) null DEFAULT null COMMENT 'Job Manager Host',
`version` varchar(20) null DEFAULT null COMMENT 'version',
`status` int(11) null DEFAULT null COMMENT 'cluster status',
`note` varchar(255) null DEFAULT null COMMENT 'note',
`auto_registers` tinyint(1) null DEFAULT 0 COMMENT 'is auto registration',
`cluster_configuration_id` int(11) null DEFAULT null COMMENT 'cluster configuration id',
`task_id` int(11) null DEFAULT null COMMENT 'task ID',
`enabled` tinyint(1) NOT null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_cluster_configuration` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`name` varchar(255) NOT null COMMENT 'cluster configuration name',
`type` varchar(50) null DEFAULT null COMMENT 'cluster type',
`config_json` text null COMMENT 'json of configuration',
`is_available` tinyint(1) NOT null DEFAULT 0 COMMENT 'is available',
`note` varchar(255) null DEFAULT null COMMENT 'note',
`enabled` tinyint(1) NOT null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_database` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`name` varchar(30) NOT null COMMENT 'database name',
`group_name` varchar(255) null DEFAULT 'Default' COMMENT 'database belong group name',
`type` varchar(50) NOT null COMMENT 'database type',
`connect_config` text NOT null COMMENT 'database type',
`note` varchar(255) null DEFAULT null COMMENT 'note',
`flink_config` text null COMMENT 'Flink configuration',
`flink_template` text null COMMENT 'Flink template',
`db_version` varchar(255) null DEFAULT null COMMENT 'version,such as: 11g of oracle ,2.2.3 of hbase',
`status` tinyint(1) null DEFAULT null COMMENT 'heartbeat status',
`health_time` datetime(0) null DEFAULT null COMMENT 'last heartbeat time of trigger',
`heartbeat_time` datetime(0) null DEFAULT null COMMENT 'last heartbeat time',
`enabled` tinyint(1) NOT null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_flink_document` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`category` varchar(255) null DEFAULT null COMMENT 'document category',
`type` varchar(255) null DEFAULT null COMMENT 'document type',
`subtype` varchar(255) null DEFAULT null COMMENT 'document subtype',
`name` varchar(255) null DEFAULT null COMMENT 'document name',
`description` longtext null,
`fill_value` longtext null COMMENT 'fill value',
`version` varchar(255) null DEFAULT null COMMENT 'document version such as:(flink1.12,flink1.13,flink1.14,flink1.15)',
`like_num` int(11) null DEFAULT 0 COMMENT 'like number',
`enabled` tinyint(1) NOT null DEFAULT 0 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update_time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_fragment` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`name` varchar(50) NOT null COMMENT 'fragment name',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`fragment_value` text NOT null COMMENT 'fragment value',
`note` text null COMMENT 'note',
`enabled` tinyint(4) null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_history` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`cluster_id` int(11) NOT null DEFAULT 0 COMMENT 'cluster ID',
`cluster_configuration_id` int(11) null DEFAULT null COMMENT 'cluster configuration id',
`session` varchar(255) null DEFAULT null COMMENT 'session',
`job_id` varchar(255) null DEFAULT null COMMENT 'Job ID',
`job_name` varchar(255) null DEFAULT null COMMENT 'Job Name',
`job_manager_address` varchar(255) null DEFAULT null COMMENT 'JJobManager Address',
`batch_model` boolean null DEFAULT false COMMENT 'is batch model',
`status` int(11) NOT null DEFAULT 0 COMMENT 'status',
`type` varchar(50) null DEFAULT null COMMENT 'job type',
`statement` text null COMMENT 'statement set',
`error` text null COMMENT 'error message',
`result` text null COMMENT 'result set',
`config_json` text null COMMENT 'config json',
`start_time` datetime(0) null DEFAULT null COMMENT 'job start time',
`end_time` datetime(0) null DEFAULT null COMMENT 'job end time',
`task_id` int(11) null DEFAULT null COMMENT 'task ID'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_job_history` (
`id` int(11) NOT null COMMENT 'id',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`job_json` text null COMMENT 'Job information json',
`exceptions_json` text null COMMENT 'error message json',
`checkpoints_json` text null COMMENT 'checkpoints json',
`checkpoints_config_json` text null COMMENT 'checkpoints configuration json',
`config_json` text null COMMENT 'configuration',
`cluster_json` text null COMMENT 'cluster instance configuration',
`cluster_configuration_json` text null COMMENT 'cluster config',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_job_instance` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`name` varchar(255) null DEFAULT null COMMENT 'job instance name',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`task_id` int(11) null DEFAULT null COMMENT 'task ID',
`step` int(11) null DEFAULT null COMMENT 'job lifecycle',
`cluster_id` int(11) null DEFAULT null COMMENT 'cluster ID',
`jid` varchar(50) null DEFAULT null COMMENT 'Flink JobId',
`status` varchar(50) null DEFAULT null COMMENT 'job instance status',
`history_id` int(11) null DEFAULT null COMMENT 'execution history ID',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`finish_time` datetime(0) null DEFAULT null COMMENT 'finish time',
`duration` bigint(20) null DEFAULT null COMMENT 'job duration',
`error` text null COMMENT 'error logs',
`failed_restart_count` int(11) null DEFAULT null COMMENT 'failed restart count',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater',
`operator` int(11) null DEFAULT null COMMENT 'operator'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_role` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_id` int(11) NOT null COMMENT 'tenant id',
`role_code` varchar(64) NOT null COMMENT 'role code',
`role_name` varchar(64) NOT null COMMENT 'role name',
`is_delete` tinyint(1) NOT null DEFAULT 0 COMMENT 'is delete',
`note` varchar(255) null DEFAULT null COMMENT 'note',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_savepoints` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`task_id` int(11) NOT null COMMENT 'task ID',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`name` varchar(255) NOT null COMMENT 'task name',
`type` varchar(255) NOT null COMMENT 'savepoint type',
`path` varchar(255) NOT null COMMENT 'savepoint path',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`creator` int(11) null DEFAULT null COMMENT 'creator'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_sys_config` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`name` varchar(255) NOT null COMMENT 'configuration name',
`value` text null COMMENT 'configuration value',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_task` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`name` varchar(255) NOT null COMMENT 'Job name',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`dialect` varchar(50) null DEFAULT null COMMENT 'dialect',
`type` varchar(50) null DEFAULT null COMMENT 'Job type',
`check_point` int(11) null DEFAULT null COMMENT 'CheckPoint trigger seconds',
`save_point_strategy` int(11) null DEFAULT null COMMENT 'SavePoint strategy',
`save_point_path` varchar(255) null DEFAULT null COMMENT 'SavePointPath',
`parallelism` int(11) null DEFAULT null COMMENT 'parallelism',
`fragment` tinyint(1) null DEFAULT 0 COMMENT 'fragment',
`statement_set` tinyint(1) null DEFAULT 0 COMMENT 'enable statement set',
`batch_model` tinyint(1) null DEFAULT 0 COMMENT 'use batch model',
`cluster_id` int(11) null DEFAULT null COMMENT 'Flink cluster ID',
`cluster_configuration_id` int(11) null DEFAULT null COMMENT 'cluster configuration ID',
`database_id` int(11) null DEFAULT null COMMENT 'database ID',
`env_id` int(11) null DEFAULT null COMMENT 'env id',
`alert_group_id` bigint(20) null DEFAULT null COMMENT 'alert group id',
`config_json` text null COMMENT 'configuration json',
`note` varchar(255) null DEFAULT null COMMENT 'Job Note',
`step` int(11) null DEFAULT 1 COMMENT 'Job lifecycle',
`job_instance_id` bigint(20) null DEFAULT null COMMENT 'job instance id',
`enabled` tinyint(1) NOT null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`version_id` int(11) null DEFAULT null COMMENT 'version id',
`statement` text null DEFAULT null COMMENT 'statement',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater',
`operator` int(11) null DEFAULT null COMMENT 'operator'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_task_version` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`task_id` int(11) NOT null COMMENT 'task ID ',
`tenant_id` int(11) NOT null DEFAULT 1 COMMENT 'tenant id',
`version_id` int(11) NOT null COMMENT 'version ID ',
`statement` text null COMMENT 'flink sql statement',
`name` varchar(255) NOT null COMMENT 'version name',
`dialect` varchar(50) null DEFAULT null COMMENT 'dialect',
`type` varchar(50) null DEFAULT null COMMENT 'type',
`task_configure` text NOT null COMMENT 'task configuration',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`creator` int(11) null DEFAULT null COMMENT 'creator'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_tenant` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`tenant_code` varchar(64) NOT null COMMENT 'tenant code',
`is_delete` tinyint(1) NOT null DEFAULT 0 COMMENT 'is delete',
`note` varchar(255) null DEFAULT null COMMENT 'note',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_udf_template` (
`id` int(11) NOT null AUTO_INCREMENT,
`name` varchar(100) null DEFAULT null COMMENT 'template name',
`code_type` varchar(10) null DEFAULT null COMMENT 'code type',
`function_type` varchar(10) null DEFAULT null COMMENT 'function type',
`template_code` longtext null COMMENT 'code',
`enabled` tinyint(1) not null DEFAULT 1 COMMENT 'is enable',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime DEFAULT null ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_user` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`username` varchar(50) NOT null COMMENT 'username',
`user_type` int DEFAULT 0 NOT null COMMENT 'login type (0:LOCAL,1:LDAP)',
`password` varchar(50) null DEFAULT null COMMENT 'password',
`nickname` varchar(50) null DEFAULT null COMMENT 'nickname',
`worknum` varchar(50) null DEFAULT null COMMENT 'worknum',
`avatar` blob null COMMENT 'avatar',
`mobile` varchar(20) null DEFAULT null COMMENT 'mobile phone',
`enabled` tinyint(1) NOT null DEFAULT 1 COMMENT 'is enable',
`super_admin_flag` tinyint(1) DEFAULT '0' COMMENT 'is super admin(0:false,1true)',
`is_delete` tinyint(1) NOT null DEFAULT 0 COMMENT 'is delete',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_user_role` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`user_id` int(11) NOT null COMMENT 'user id',
`role_id` int(11) NOT null COMMENT 'role id',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `dinky_user_tenant` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'ID',
`user_id` int(11) NOT null COMMENT 'user id',
`tenant_id` int(11) NOT null COMMENT 'tenant id',
`tenant_admin_flag` tinyint DEFAULT '0' COMMENT 'tenant admin flag(0:false,1:true)',
`create_time` datetime(0) null DEFAULT null COMMENT 'create time',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `metadata_column` (
`column_name` varchar(255) NOT null COMMENT 'column name',
`column_type` varchar(255) NOT null COMMENT 'column type, such as : Physical , Metadata , Computed , WATERMARK',
`data_type` varchar(255) NOT null COMMENT 'data type',
`expr` varchar(255) null DEFAULT null COMMENT 'expression',
`description` varchar(255) NOT null COMMENT 'column description',
`table_id` int(11) NOT null COMMENT 'table id',
`primary` bit(1) null DEFAULT null COMMENT 'table primary key',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`create_time` datetime(0) NOT null DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'create time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `metadata_database` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'id',
`database_name` varchar(255) NOT null COMMENT 'database name',
`description` varchar(255) null DEFAULT null COMMENT 'database description',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`create_time` datetime(0) null DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'create time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `metadata_database_property` (
`key` varchar(255) NOT null COMMENT 'key',
`value` varchar(255) null DEFAULT null COMMENT 'value',
`database_id` int(11) NOT null COMMENT 'database id',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`create_time` datetime(0) NOT null DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'create time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `metadata_function` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT '主键',
`function_name` varchar(255) NOT null COMMENT 'function name',
`class_name` varchar(255) NOT null COMMENT 'class name',
`database_id` int(11) NOT null COMMENT 'database id',
`function_language` varchar(255) null DEFAULT null COMMENT 'function language',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`create_time` datetime(0) null DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'create time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `metadata_table` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT '主键',
`table_name` varchar(255) NOT null COMMENT 'table name',
`table_type` varchar(255) NOT null COMMENT 'type,such as:database,table,view',
`database_id` int(11) NOT null COMMENT 'database id',
`description` varchar(255) null DEFAULT null COMMENT 'table description',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`create_time` datetime(0) null DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'create time'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
CREATE TABLE IF NOT EXISTS `metadata_table_property` (
`key` varchar(255) NOT null COMMENT 'key',
`value` mediumtext null COMMENT 'value',
`table_id` int(11) NOT null COMMENT 'table id',
`update_time` datetime(0) null DEFAULT null COMMENT 'update time',
`create_time` datetime(0) NOT null DEFAULT CURRENT_TIMESTAMP(0) COMMENT 'create tiime'
) ENGINE = InnoDB ROW_FORMAT = Dynamic;
-- ----------------------------
-- Records of metadata_table_property
-- ----------------------------
-- ----------------------------
-- Table structure for dinky_row_permissions
-- ----------------------------
CREATE TABLE IF NOT EXISTS `dinky_row_permissions` (
id int PRIMARY KEY AUTO_INCREMENT COMMENT 'ID',
role_id int NOT null COMMENT '角色ID',
table_name varchar(255) null COMMENT '表名',
expression varchar(255) null COMMENT '表达式',
create_time datetime null COMMENT '创建时间',
update_time datetime null COMMENT '更新时间',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
);
SET FOREIGN_KEY_CHECKS = 1;
CREATE TABLE IF NOT EXISTS `dinky_git_project` (
`id` bigint(20) NOT null AUTO_INCREMENT,
`tenant_id` bigint(20) NOT null,
`name` varchar(255) NOT null,
`url` varchar(1000) NOT null,
`branch` varchar(1000) NOT null,
`username` varchar(255) DEFAULT null,
`password` varchar(255) DEFAULT null,
`private_key` varchar(255) DEFAULT null COMMENT 'keypath',
`pom` varchar(255) DEFAULT null,
`build_args` varchar(255) DEFAULT null,
`code_type` tinyint(4) DEFAULT null COMMENT 'code type(1-java,2-python)',
`type` tinyint(4) NOT null COMMENT '1-http ,2-ssh',
`last_build` datetime DEFAULT null,
`description` varchar(255) DEFAULT null,
`build_state` tinyint(2) NOT null DEFAULT '0' COMMENT '0-notStart 1-process 2-failed 3-success',
`build_step` tinyint(2) NOT null DEFAULT '0',
`enabled` tinyint(1) NOT null DEFAULT '1' COMMENT '0-disable 1-enable',
`udf_class_map_list` text COMMENT 'scan udf class',
`order_line` int(11) NOT null DEFAULT '1' COMMENT 'order',
`create_time` datetime NOT null DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`update_time` datetime NOT null DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater',
`operator` int(11) null DEFAULT null COMMENT 'operator'
) ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `dinky_metrics` (
`id` int(11) NOT null AUTO_INCREMENT,
`task_id` int(255) DEFAULT null,
`vertices` varchar(255) DEFAULT null,
`metrics` varchar(255) DEFAULT null,
`position` int(11) DEFAULT null,
`show_type` varchar(255) DEFAULT null,
`show_size` varchar(255) DEFAULT null,
`title` CLOB DEFAULT null,
`layout_name` varchar(255) DEFAULT null,
`create_time` datetime DEFAULT null,
`update_time` datetime DEFAULT null
) ENGINE = InnoDB;
CREATE TABLE IF NOT EXISTS `dinky_resources` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'key',
`file_name` varchar(64) DEFAULT null COMMENT 'file name',
`description` varchar(255) DEFAULT null,
`user_id` int(11) DEFAULT null COMMENT 'user id',
`type` tinyint(4) DEFAULT null COMMENT 'resource type,0:FILE,1:UDF',
`size` bigint(20) DEFAULT null COMMENT 'resource size',
`pid` int(11) DEFAULT null,
`full_name` text DEFAULT null,
`is_directory` tinyint(4) DEFAULT null,
`create_time` datetime NOT null DEFAULT CURRENT_TIMESTAMP COMMENT 'create time',
`update_time` datetime NOT null DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT 'update time',
`creator` int(11) null DEFAULT null COMMENT 'creator',
`updater` int(11) null DEFAULT null COMMENT 'updater'
) ENGINE = InnoDB;
-- ----------------------------
-- Table structure for dinky_sys_login_log
-- ----------------------------
CREATE TABLE IF NOT EXISTS `dinky_sys_login_log` (
`id` int(11) NOT null AUTO_INCREMENT COMMENT 'key',
`user_id` int(11) NOT null COMMENT 'user id',
`username` varchar(60) NOT null COMMENT 'username',
`login_type` int NOT null COMMENT 'login type(0:LOCAL,1:LDAP)',
`ip` varchar(40) NOT null COMMENT 'ip addr',
`status` int NOT null COMMENT 'login status',
`msg` text NOT null COMMENT 'status msg',
`create_time` datetime NOT null COMMENT 'create time',
`access_time` datetime DEFAULT null COMMENT 'access time',
`update_time` datetime NOT null,
`is_deleted` tinyint(1) NOT null DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
-- ----------------------------
-- Table structure for dinky_sys_operate_log
-- ----------------------------
CREATE TABLE IF NOT EXISTS `dinky_sys_operate_log` (
`id` bigint NOT null AUTO_INCREMENT COMMENT 'id',
`module_name` varchar(50) DEFAULT '' COMMENT 'module name',
`business_type` int null DEFAULT 0 COMMENT 'business type',
`method` varchar(100) null DEFAULT '' COMMENT 'method name',
`request_method` varchar(10) null DEFAULT '' COMMENT 'request method',
`operate_name` varchar(50) DEFAULT '' COMMENT 'operate name',
`operate_user_id` int NOT null COMMENT 'operate user id',
`operate_url` varchar(255) DEFAULT '' COMMENT 'operate url',
`operate_ip` varchar(50) DEFAULT '' COMMENT 'ip',
`operate_location` varchar(255) DEFAULT '' COMMENT 'operate location',
`operate_param` longtext DEFAULT '' COMMENT 'request param',
`json_result` longtext DEFAULT null COMMENT 'return json result',
`status` int null DEFAULT null COMMENT 'operate status',
`error_msg` longtext DEFAULT null COMMENT 'error msg',
`operate_time` datetime(0) DEFAULT null COMMENT 'operate time',
PRIMARY KEY (`id`)
) ENGINE = InnoDB;
-- ----------------------------
-- Table structure for dinky_sys_menu
-- ----------------------------
CREATE TABLE IF NOT EXISTS `dinky_sys_menu` (
`id` bigint not null auto_increment comment ' id',
`parent_id` bigint not null comment 'parent menu id',
`name` varchar(64) not null comment 'menu button name',
`path` varchar(64) default null comment 'routing path',
`component` varchar(64) default null comment 'routing component component',
`perms` varchar(64) default null comment 'authority id',
`icon` varchar(64) default null comment 'icon',
`type` char(1) default null comment 'type(M:directory C:menu F:button)',
`display` tinyint default 1 comment 'whether the menu is displayed',
`order_num` int default null comment 'sort',
`create_time` datetime not null default current_timestamp comment 'create time',
`update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time',
`note` varchar(255) default null comment 'note',
primary key (`id`)
) engine=innodb ;
-- ----------------------------
-- Table structure dinky_sys_role_menu
-- ----------------------------
CREATE TABLE IF NOT EXISTS `dinky_sys_role_menu` (
`id` bigint NOT null AUTO_INCREMENT COMMENT 'id',
`role_id` bigint NOT null COMMENT 'role id',
`menu_id` bigint NOT null COMMENT 'menu id',
`create_time` datetime not null default current_timestamp comment 'create time',
`update_time` datetime not null default current_timestamp on update current_timestamp comment 'modify time',
PRIMARY KEY (`id`),
UNIQUE KEY `un_role_menu_inx` (`role_id`,`menu_id`)
) ENGINE=InnoDB ;
-- ----------------------------
-- Table structure updater
-- ----------------------------
CREATE TABLE IF NOT EXISTS `dinky_sys_token` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id',
`token_value` varchar(255) NOT NULL COMMENT 'token value',
`user_id` bigint NOT NULL COMMENT 'user id',
`role_id` bigint NOT NULL COMMENT 'role id',
`tenant_id` bigint NOT NULL COMMENT 'tenant id',
`expire_type` tinyint NOT NULL COMMENT '1: never expire, 2: expire after a period of time, 3: expire at a certain time',
`expire_start_time` datetime DEFAULT NULL COMMENT 'expire start time ,when expire_type = 3 , it is the start time of the period',
`expire_end_time` datetime DEFAULT NULL COMMENT 'expire end time ,when expire_type = 2,3 , it is the end time of the period',
`create_time` datetime NOT NULL COMMENT 'create time',
`update_time` datetime NOT NULL COMMENT 'modify time',
`source` tinyint(2) DEFAULT NULL COMMENT '1:login 2:custom',
`creator` bigint DEFAULT NULL COMMENT 'creator',
`updater` bigint DEFAULT NULL COMMENT 'updater',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=0 DEFAULT CHARSET=utf8mb4 COMMENT='token management';
-- ----------------------------
-- Table structure dinky_sys_alert
-- ----------------------------
create table if not exists `dinky_alert_template`
(
id int auto_increment
primary key COMMENT 'id',
name varchar(20) COMMENT 'template name',
template_content text null COMMENT 'template content',
enabled tinyint default 1 null COMMENT 'is enable',
create_time datetime null COMMENT 'create time',
update_time datetime null COMMENT 'update time',
`creator` bigint DEFAULT NULL COMMENT 'creator',
`updater` bigint DEFAULT NULL COMMENT 'updater'
);
create table if not exists `dinky_alert_rules`
(
id int auto_increment
primary key comment 'id',
name varchar(40) unique not null comment 'rule name',
rule text null comment 'specify rule',
template_id int null comment 'template id',
rule_type varchar(10) null comment 'alert rule type',
trigger_conditions varchar(20) null comment 'trigger conditions',
description text null comment 'description',
enabled tinyint default 1 null comment 'is enable',
create_time datetime null comment 'create time',
update_time datetime null comment 'update time',
`creator` bigint DEFAULT NULL COMMENT 'creator',
`updater` bigint DEFAULT NULL COMMENT 'updater'
);
CREATE TABLE IF NOT EXISTS `dinky_udf_manage` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) DEFAULT NULL COMMENT 'udf name',
`class_name` varchar(50) DEFAULT NULL COMMENT 'Complete class name',
`task_id` int(11) DEFAULT NULL COMMENT 'task id',
`resources_id` int(11) DEFAULT NULL COMMENT 'resources id',
`enabled` tinyint(1) DEFAULT 1 COMMENT 'is enable',
`create_time` datetime DEFAULT NULL COMMENT 'create time',
`update_time` datetime DEFAULT NULL COMMENT 'update time',
`creator` bigint DEFAULT NULL COMMENT 'creator',
`updater` bigint DEFAULT NULL COMMENT 'updater'
) ENGINE = InnoDB ROW_FORMAT = DYNAMIC;
INSERT INTO `dinky_role` INSERT INTO `dinky_role`
VALUES ( 1, 1, 'SuperAdmin', 'SuperAdmin', 0 VALUES ( 1, 1, 'SuperAdmin', 'SuperAdmin', 0
, 'SuperAdmin of Role', '2022-12-13 05:27:19', '2022-12-13 05:27:19'); , 'SuperAdmin of Role', '2022-12-13 05:27:19', '2022-12-13 05:27:19');
...@@ -2529,4 +3167,4 @@ from pyflink.table.udf import udf ...@@ -2529,4 +3167,4 @@ from pyflink.table.udf import udf
@udf(result_type=DataTypes.STRING()) @udf(result_type=DataTypes.STRING())
def ${className}(variable1:str): def ${className}(variable1:str):
return ''''' return '''''
, 1, '2022-10-25 09:25:13', '2022-10-25 09:34:47', null, null); , 1, '2022-10-25 09:25:13', '2022-10-25 09:34:47', null, null);
\ No newline at end of file
update dinky_sys_menu
set `path`='/registration/alert/rule',
`component`='./RegCenter/Alert/AlertRule',
`perms`='registration:alert:rule',
`parent_id`=12
where `id` = 116;
update dinky_sys_menu
set `path`='/registration/alert/rule/add',
`perms`='registration:alert:rule:add'
where `id` = 117;
update dinky_sys_menu
set `path`='/registration/alert/rule/delete',
`perms`='registration:alert:rule:delete'
where `id` = 118;
update dinky_sys_menu
set `path`='/registration/alert/rule/edit',
`perms`='registration:alert:rule:edit'
where `id` = 119;
-- Increase class_name column's length from 50 to 100.
ALTER TABLE dinky_udf_manage CHANGE COLUMN class_name class_name VARCHAR(100) null DEFAULT null COMMENT 'Complete class name';
ALTER TABLE dinky_task
add COLUMN `first_level_owner` int DEFAULT NULL comment 'primary responsible person id';
ALTER TABLE dinky_task
add COLUMN `second_level_owners` varchar(128) DEFAULT NULL comment 'list of secondary responsible persons ids';
update dinky_task set first_level_owner = creator;
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;
update dinky_sys_menu
set `path`='/registration/alert/rule',
`component`='./RegCenter/Alert/AlertRule',
`perms`='registration:alert:rule',
`parent_id`=12
where `id` = 116;
update dinky_sys_menu
set `path`='/registration/alert/rule/add',
`perms`='registration:alert:rule:add'
where `id` = 117;
update dinky_sys_menu
set `path`='/registration/alert/rule/delete',
`perms`='registration:alert:rule:delete'
where `id` = 118;
update dinky_sys_menu
set `path`='/registration/alert/rule/edit',
`perms`='registration:alert:rule:edit'
where `id` = 119;
-- Increase class_name column's length from 50 to 100.
ALTER TABLE dinky_udf_manage CHANGE COLUMN class_name class_name VARCHAR(100) null DEFAULT null COMMENT 'Complete class name';
ALTER TABLE dinky_task
add COLUMN `first_level_owner` int DEFAULT NULL comment 'primary responsible person id';
ALTER TABLE dinky_task
add COLUMN `second_level_owners` varchar(128) DEFAULT NULL comment 'list of secondary responsible persons ids';
update dinky_task set first_level_owner = creator;
ALTER TABLE dinky_alert_template MODIFY COLUMN `name` varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT 'template name';
SET FOREIGN_KEY_CHECKS = 1;
This source diff could not be displayed because it is too large. You can view the blob instead.
update public.dinky_sys_menu
set "path"='/registration/alert/rule',
"component"='./RegCenter/Alert/AlertRule',
"perms"='registration:alert:rule',
"parent_id"=12
where "id" = 116;
update "public"."dinky_sys_menu"
set "path"='/registration/alert/rule/add',
"perms"='registration:alert:rule:add'
where "id" = 117;
update public.dinky_sys_menu
set "path"='/registration/alert/rule/delete',
"perms"='registration:alert:rule:delete'
where "id" = 118;
update public.dinky_sys_menu
set "path"='/registration/alert/rule/edit',
"perms"='registration:alert:rule:edit'
where "id" = 119;
-- Increase class_name column's length from 50 to 100.
ALTER TABLE public.dinky_udf_manage ALTER COLUMN class_name TYPE VARCHAR(100);
COMMENT ON COLUMN public.dinky_udf_manage."class_name" IS 'Complete class name';
alter table public.dinky_task add column "first_level_owner" int;
alter table public.dinky_task add column "second_level_owners" varchar(128);
COMMENT ON COLUMN public.dinky_task."first_level_owner" IS 'primary responsible person id';
COMMENT ON COLUMN public.dinky_task."second_level_owners" IS 'list of secondary responsible persons ids';
update public.dinky_task set "first_level_owner" = "creator";
...@@ -63,6 +63,7 @@ ...@@ -63,6 +63,7 @@
<easy.rules.version>4.1.0</easy.rules.version> <easy.rules.version>4.1.0</easy.rules.version>
<fastjson2.version>2.0.41</fastjson2.version> <fastjson2.version>2.0.41</fastjson2.version>
<flink.version>1.18.1</flink.version> <flink.version>1.18.1</flink.version>
<flyway.version>10.10.12</flyway.version>
<guava.version>32.1.3-jre</guava.version> <guava.version>32.1.3-jre</guava.version>
<h2database.version>1.4.200</h2database.version> <h2database.version>1.4.200</h2database.version>
<hamcrest.version>1.3</hamcrest.version> <hamcrest.version>1.3</hamcrest.version>
...@@ -119,7 +120,7 @@ ...@@ -119,7 +120,7 @@
<snakeyaml.version>1.33</snakeyaml.version> <snakeyaml.version>1.33</snakeyaml.version>
<spotless.ratchetFrom>origin/dev</spotless.ratchetFrom> <spotless.ratchetFrom>origin/dev</spotless.ratchetFrom>
<spotless.version>2.27.1</spotless.version> <spotless.version>2.27.1</spotless.version>
<spring-boot-dependencies.version>2.7.11</spring-boot-dependencies.version> <spring-boot-dependencies.version>2.7.18</spring-boot-dependencies.version>
<spring.ldap.version>3.1.0</spring.ldap.version> <spring.ldap.version>3.1.0</spring.ldap.version>
<target.java.version>8</target.java.version> <target.java.version>8</target.java.version>
<testcontainers.version>1.16.2</testcontainers.version> <testcontainers.version>1.16.2</testcontainers.version>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment