Browse Source

add table name change ddl (#866)

* Remove useless dependencies and add jsp-2.1-6.1.14

* Determine if principal is empty in getJdbcUrl method

* fix bug  when register worker but create master node in zookeeper

* Remove useless dependencies such as hive-shims and log4j

* upgrade commons-email from 1.2 to 1.5 and remove mail-1.4.5.jar

* add support for postgresql in upgrade database

* add support for postgresql in upgrade database

* update mysql in upgrade from 1.1.0 to next version

* add table name change ddl
pull/2/head
lgcareer 5 years ago committed by qiaozhanwei
parent
commit
c08b5189fa
  1. 11
      escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/DolphinSchedulerManager.java
  2. 9
      escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/MysqlUpgradeDao.java
  3. 21
      escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/PostgresqlUpgradeDao.java
  4. 34
      escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/UpgradeDao.java
  5. 486
      sql/upgrade/1.2.0_schema/mysql/dolphinscheduler_ddl.sql

11
escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/DolphinSchedulerManager.java

@ -81,7 +81,9 @@ public class DolphinSchedulerManager {
String version = ""; String version = "";
// Gets the version of the current system // Gets the version of the current system
if (upgradeDao.isExistsTable("t_escheduler_version")) { if (upgradeDao.isExistsTable("t_escheduler_version")) {
version = upgradeDao.getCurrentVersion(); version = upgradeDao.getCurrentVersion("t_escheduler_version");
}else if(upgradeDao.isExistsTable("t_dolphinscheduler_version")){
version = upgradeDao.getCurrentVersion("t_dolphinscheduler_version");
}else if(upgradeDao.isExistsColumn("t_escheduler_queue","create_time")){ }else if(upgradeDao.isExistsColumn("t_escheduler_queue","create_time")){
version = "1.0.1"; version = "1.0.1";
}else if(upgradeDao.isExistsTable("t_escheduler_queue")){ }else if(upgradeDao.isExistsTable("t_escheduler_queue")){
@ -93,22 +95,15 @@ public class DolphinSchedulerManager {
// The target version of the upgrade // The target version of the upgrade
String schemaVersion = ""; String schemaVersion = "";
for(String schemaDir : schemaList) { for(String schemaDir : schemaList) {
schemaVersion = schemaDir.split("_")[0]; schemaVersion = schemaDir.split("_")[0];
if(SchemaUtils.isAGreatVersion(schemaVersion , version)) { if(SchemaUtils.isAGreatVersion(schemaVersion , version)) {
logger.info("upgrade DolphinScheduler metadata version from " + version + " to " + schemaVersion); logger.info("upgrade DolphinScheduler metadata version from " + version + " to " + schemaVersion);
logger.info("Begin upgrading DolphinScheduler's table structure"); logger.info("Begin upgrading DolphinScheduler's table structure");
upgradeDao.upgradeDolphinScheduler(schemaDir); upgradeDao.upgradeDolphinScheduler(schemaDir);
if(SchemaUtils.isAGreatVersion(version,"1.0.1")){
version = upgradeDao.getCurrentVersion();
}else {
version = schemaVersion; version = schemaVersion;
} }
}
} }
} }

9
escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/MysqlUpgradeDao.java

@ -28,8 +28,6 @@ import java.sql.SQLException;
public class MysqlUpgradeDao extends UpgradeDao { public class MysqlUpgradeDao extends UpgradeDao {
public static final Logger logger = LoggerFactory.getLogger(UpgradeDao.class); public static final Logger logger = LoggerFactory.getLogger(UpgradeDao.class);
private static final String T_VERSION_NAME = "t_escheduler_version";
private static final String rootDir = System.getProperty("user.dir");
@Override @Override
protected void init() { protected void init() {
@ -54,10 +52,11 @@ public class MysqlUpgradeDao extends UpgradeDao {
* @return * @return
*/ */
public boolean isExistsTable(String tableName) { public boolean isExistsTable(String tableName) {
ResultSet rs = null;
Connection conn = null; Connection conn = null;
try { try {
conn = ConnectionFactory.getDataSource().getConnection(); conn = ConnectionFactory.getDataSource().getConnection();
ResultSet rs = conn.getMetaData().getTables(null, null, tableName, null); rs = conn.getMetaData().getTables(null, null, tableName, null);
if (rs.next()) { if (rs.next()) {
return true; return true;
} else { } else {
@ -68,8 +67,7 @@ public class MysqlUpgradeDao extends UpgradeDao {
logger.error(e.getMessage(),e); logger.error(e.getMessage(),e);
throw new RuntimeException(e.getMessage(),e); throw new RuntimeException(e.getMessage(),e);
} finally { } finally {
ConnectionUtils.releaseResource(null, null, conn); ConnectionUtils.releaseResource(rs, null, conn);
} }
} }
@ -96,7 +94,6 @@ public class MysqlUpgradeDao extends UpgradeDao {
throw new RuntimeException(e.getMessage(),e); throw new RuntimeException(e.getMessage(),e);
} finally { } finally {
ConnectionUtils.releaseResource(null, null, conn); ConnectionUtils.releaseResource(null, null, conn);
} }
} }

21
escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/PostgresqlUpgradeDao.java

@ -29,8 +29,6 @@ import java.sql.SQLException;
public class PostgresqlUpgradeDao extends UpgradeDao { public class PostgresqlUpgradeDao extends UpgradeDao {
public static final Logger logger = LoggerFactory.getLogger(UpgradeDao.class); public static final Logger logger = LoggerFactory.getLogger(UpgradeDao.class);
private static final String T_VERSION_NAME = "t_escheduler_version";
private static final String rootDir = System.getProperty("user.dir");
private static final String schema = getSchema(); private static final String schema = getSchema();
@Override @Override
@ -55,23 +53,24 @@ public class PostgresqlUpgradeDao extends UpgradeDao {
super.initSchema(initSqlPath); super.initSchema(initSqlPath);
} }
private static String getSchema(){ public static String getSchema(){
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
ResultSet resultSet = null;
try { try {
conn = ConnectionFactory.getDataSource().getConnection(); conn = ConnectionFactory.getDataSource().getConnection();
pstmt = conn.prepareStatement("select current_schema()"); pstmt = conn.prepareStatement("select current_schema()");
ResultSet resultSet = pstmt.executeQuery(); resultSet = pstmt.executeQuery();
while (resultSet.next()){ while (resultSet.next()){
if(resultSet.isFirst()){ if(resultSet.isFirst()){
return resultSet.getString(1); return resultSet.getString(1);
} }
} }
} catch (SQLException e) { } catch (SQLException e) {
logger.error(e.getMessage(),e); logger.error(e.getMessage(),e);
} finally { } finally {
ConnectionUtils.releaseResource(null, null, conn); ConnectionUtils.releaseResource(resultSet, pstmt, conn);
} }
return ""; return "";
} }
@ -83,10 +82,11 @@ public class PostgresqlUpgradeDao extends UpgradeDao {
*/ */
public boolean isExistsTable(String tableName) { public boolean isExistsTable(String tableName) {
Connection conn = null; Connection conn = null;
ResultSet rs = null;
try { try {
conn = ConnectionFactory.getDataSource().getConnection(); conn = ConnectionFactory.getDataSource().getConnection();
ResultSet rs = conn.getMetaData().getTables(null, schema, tableName, null); rs = conn.getMetaData().getTables(null, schema, tableName, null);
if (rs.next()) { if (rs.next()) {
return true; return true;
} else { } else {
@ -97,7 +97,7 @@ public class PostgresqlUpgradeDao extends UpgradeDao {
logger.error(e.getMessage(),e); logger.error(e.getMessage(),e);
throw new RuntimeException(e.getMessage(),e); throw new RuntimeException(e.getMessage(),e);
} finally { } finally {
ConnectionUtils.releaseResource(null, null, conn); ConnectionUtils.releaseResource(rs, null, conn);
} }
} }
@ -110,9 +110,10 @@ public class PostgresqlUpgradeDao extends UpgradeDao {
*/ */
public boolean isExistsColumn(String tableName,String columnName) { public boolean isExistsColumn(String tableName,String columnName) {
Connection conn = null; Connection conn = null;
ResultSet rs = null;
try { try {
conn = ConnectionFactory.getDataSource().getConnection(); conn = ConnectionFactory.getDataSource().getConnection();
ResultSet rs = conn.getMetaData().getColumns(null,schema,tableName,columnName); rs = conn.getMetaData().getColumns(null,schema,tableName,columnName);
if (rs.next()) { if (rs.next()) {
return true; return true;
} else { } else {
@ -123,7 +124,7 @@ public class PostgresqlUpgradeDao extends UpgradeDao {
logger.error(e.getMessage(),e); logger.error(e.getMessage(),e);
throw new RuntimeException(e.getMessage(),e); throw new RuntimeException(e.getMessage(),e);
} finally { } finally {
ConnectionUtils.releaseResource(null, null, conn); ConnectionUtils.releaseResource(rs, null, conn);
} }

34
escheduler-dao/src/main/java/cn/escheduler/dao/upgrade/UpgradeDao.java

@ -18,6 +18,7 @@ package cn.escheduler.dao.upgrade;
import cn.escheduler.common.enums.DbType; import cn.escheduler.common.enums.DbType;
import cn.escheduler.common.utils.ConnectionUtils; import cn.escheduler.common.utils.ConnectionUtils;
import cn.escheduler.common.utils.SchemaUtils;
import cn.escheduler.common.utils.ScriptRunner; import cn.escheduler.common.utils.ScriptRunner;
import cn.escheduler.dao.AbstractBaseDao; import cn.escheduler.dao.AbstractBaseDao;
import cn.escheduler.dao.datasource.ConnectionFactory; import cn.escheduler.dao.datasource.ConnectionFactory;
@ -36,7 +37,9 @@ public abstract class UpgradeDao extends AbstractBaseDao {
public static final Logger logger = LoggerFactory.getLogger(UpgradeDao.class); public static final Logger logger = LoggerFactory.getLogger(UpgradeDao.class);
private static final String T_VERSION_NAME = "t_escheduler_version"; private static final String T_VERSION_NAME = "t_escheduler_version";
private static final String T_NEW_VERSION_NAME = "t_dolphinscheduler_version";
private static final String rootDir = System.getProperty("user.dir"); private static final String rootDir = System.getProperty("user.dir");
private static final DbType dbType = getCurrentDbType();
@Override @Override
protected void init() { protected void init() {
@ -48,13 +51,24 @@ public abstract class UpgradeDao extends AbstractBaseDao {
* @return * @return
*/ */
public static DbType getDbType(){ public static DbType getDbType(){
return dbType;
}
/**
* get db type
* @return
*/
private static DbType getCurrentDbType(){
Connection conn = null;
try { try {
Connection conn = ConnectionFactory.getDataSource().getConnection(); conn = ConnectionFactory.getDataSource().getConnection();
String name = conn.getMetaData().getDatabaseProductName().toUpperCase(); String name = conn.getMetaData().getDatabaseProductName().toUpperCase();
return DbType.valueOf(name); return DbType.valueOf(name);
} catch (Exception e) { } catch (Exception e) {
logger.error(e.getMessage(),e); logger.error(e.getMessage(),e);
return null; return null;
}finally {
ConnectionUtils.releaseResource(null, null, conn);
} }
} }
@ -175,8 +189,8 @@ public abstract class UpgradeDao extends AbstractBaseDao {
public abstract boolean isExistsColumn(String tableName,String columnName); public abstract boolean isExistsColumn(String tableName,String columnName);
public String getCurrentVersion() { public String getCurrentVersion(String versionName) {
String sql = String.format("select version from %s",T_VERSION_NAME); String sql = String.format("select version from %s",versionName);
Connection conn = null; Connection conn = null;
ResultSet rs = null; ResultSet rs = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
@ -231,6 +245,12 @@ public abstract class UpgradeDao extends AbstractBaseDao {
pstmt = conn.prepareStatement(upgradeSQL); pstmt = conn.prepareStatement(upgradeSQL);
pstmt.setString(1, schemaVersion); pstmt.setString(1, schemaVersion);
pstmt.executeUpdate(); pstmt.executeUpdate();
}else if (isExistsTable(T_NEW_VERSION_NAME)) {
// Change version in the version table to the new version
String upgradeSQL = String.format("update %s set version = ?",T_NEW_VERSION_NAME);
pstmt = conn.prepareStatement(upgradeSQL);
pstmt.setString(1, schemaVersion);
pstmt.executeUpdate();
} }
conn.commit(); conn.commit();
} catch (FileNotFoundException e) { } catch (FileNotFoundException e) {
@ -275,7 +295,7 @@ public abstract class UpgradeDao extends AbstractBaseDao {
if (StringUtils.isEmpty(rootDir)) { if (StringUtils.isEmpty(rootDir)) {
throw new RuntimeException("Environment variable user.dir not found"); throw new RuntimeException("Environment variable user.dir not found");
} }
String mysqlSQLFilePath = MessageFormat.format("{0}/sql/upgrade/{1}/{2}/dolphinscheduler_dml.sql",rootDir,schemaDir,getDbType().name().toLowerCase()); String mysqlSQLFilePath = MessageFormat.format("{0}/sql/upgrade/{1}/{2}/dolphinscheduler_ddl.sql",rootDir,schemaDir,getDbType().name().toLowerCase());
Connection conn = null; Connection conn = null;
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try { try {
@ -314,7 +334,11 @@ public abstract class UpgradeDao extends AbstractBaseDao {
public void updateVersion(String version) { public void updateVersion(String version) {
// Change version in the version table to the new version // Change version in the version table to the new version
String upgradeSQL = String.format("update %s set version = ?",T_VERSION_NAME); String versionName = T_VERSION_NAME;
if(!SchemaUtils.isAGreatVersion("1.2.0" , version)){
versionName = "t_dolphinscheduler_version";
}
String upgradeSQL = String.format("update %s set version = ?",versionName);
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
Connection conn = null; Connection conn = null;
try { try {

486
sql/upgrade/1.2.0_schema/mysql/dolphinscheduler_ddl.sql

@ -0,0 +1,486 @@
SET sql_mode=(SELECT REPLACE(@@sql_mode,'ONLY_FULL_GROUP_BY',''));
-- ut_dolphin_T_t_dolphinscheduler_access_token
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_access_token;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_access_token()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_access_token'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_access_token RENAME t_dolphinscheduler_access_token;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_access_token;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_access_token;
-- ut_dolphin_T_t_dolphinscheduler_alert
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_alert;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_alert()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_alert'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_alert RENAME t_dolphinscheduler_alert;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_alert;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_alert;
-- ut_dolphin_T_t_dolphinscheduler_alertgroup
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_alertgroup;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_alertgroup()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_alertgroup'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_alertgroup RENAME t_dolphinscheduler_alertgroup;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_alertgroup;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_alertgroup;
-- ut_dolphin_T_t_dolphinscheduler_command
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_command;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_command()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_command'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_command RENAME t_dolphinscheduler_command;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_command;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_command;
-- ut_dolphin_T_t_dolphinscheduler_datasource
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_datasource;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_datasource()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_datasource'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_datasource RENAME t_dolphinscheduler_datasource;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_datasource;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_datasource;
-- ut_dolphin_T_t_dolphinscheduler_error_command
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_error_command;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_error_command()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_error_command'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_error_command RENAME t_dolphinscheduler_error_command;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_error_command;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_error_command;
-- ut_dolphin_T_t_dolphinscheduler_master_server
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_master_server;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_master_server()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_master_server'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_master_server RENAME t_dolphinscheduler_master_server;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_master_server;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_master_server;
-- ut_dolphin_T_t_dolphinscheduler_process_definition
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_process_definition;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_process_definition()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_process_definition'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_process_definition RENAME t_dolphinscheduler_process_definition;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_process_definition;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_process_definition;
-- ut_dolphin_T_t_dolphinscheduler_process_instance
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_process_instance;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_process_instance()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_process_instance'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_process_instance RENAME t_dolphinscheduler_process_instance;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_process_instance;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_process_instance;
-- ut_dolphin_T_t_dolphinscheduler_project
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_project;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_project()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_project'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_project RENAME t_dolphinscheduler_project;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_project;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_project;
-- ut_dolphin_T_t_dolphinscheduler_queue
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_queue;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_queue()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_queue'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_queue RENAME t_dolphinscheduler_queue;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_queue;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_queue;
-- ut_dolphin_T_t_dolphinscheduler_relation_datasource_user
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_relation_datasource_user;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_relation_datasource_user()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_relation_datasource_user'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_relation_datasource_user RENAME t_dolphinscheduler_relation_datasource_user;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_relation_datasource_user;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_relation_datasource_user;
-- ut_dolphin_T_t_dolphinscheduler_relation_process_instance
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_relation_process_instance;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_relation_process_instance()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_relation_process_instance'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_relation_process_instance RENAME t_dolphinscheduler_relation_process_instance;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_relation_process_instance;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_relation_process_instance;
-- ut_dolphin_T_t_dolphinscheduler_relation_project_user
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_relation_project_user;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_relation_project_user()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_relation_project_user'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_relation_project_user RENAME t_dolphinscheduler_relation_project_user;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_relation_project_user;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_relation_project_user;
-- ut_dolphin_T_t_dolphinscheduler_relation_resources_user
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_relation_resources_user;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_relation_resources_user()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_relation_resources_user'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_relation_resources_user RENAME t_dolphinscheduler_relation_resources_user;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_relation_resources_user;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_relation_resources_user;
-- ut_dolphin_T_t_dolphinscheduler_relation_udfs_user
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_relation_udfs_user;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_relation_udfs_user()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_relation_udfs_user'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_relation_udfs_user RENAME t_dolphinscheduler_relation_udfs_user;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_relation_udfs_user;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_relation_udfs_user;
-- ut_dolphin_T_t_dolphinscheduler_relation_user_alertgroup
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_relation_user_alertgroup;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_relation_user_alertgroup()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_relation_user_alertgroup'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_relation_user_alertgroup RENAME t_dolphinscheduler_relation_user_alertgroup;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_relation_user_alertgroup;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_relation_user_alertgroup;
-- ut_dolphin_T_t_dolphinscheduler_resources
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_resources;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_resources()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_resources'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_resources RENAME t_dolphinscheduler_resources;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_resources;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_resources;
-- ut_dolphin_T_t_dolphinscheduler_schedules
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_schedules;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_schedules()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_schedules'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_schedules RENAME t_dolphinscheduler_schedules;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_schedules;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_schedules;
-- ut_dolphin_T_t_dolphinscheduler_session
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_session;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_session()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_session'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_session RENAME t_dolphinscheduler_session;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_session;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_session;
-- ut_dolphin_T_t_dolphinscheduler_task_instance
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_task_instance;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_task_instance()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_task_instance'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_task_instance RENAME t_dolphinscheduler_task_instance;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_task_instance;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_task_instance;
-- ut_dolphin_T_t_dolphinscheduler_tenant
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_tenant;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_tenant()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_tenant'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_tenant RENAME t_dolphinscheduler_tenant;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_tenant;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_tenant;
-- ut_dolphin_T_t_dolphinscheduler_udfs
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_udfs;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_udfs()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_udfs'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_udfs RENAME t_dolphinscheduler_udfs;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_udfs;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_udfs;
-- ut_dolphin_T_t_dolphinscheduler_user
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_user;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_user()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_user'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_user RENAME t_dolphinscheduler_user;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_user;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_user;
-- ut_dolphin_T_t_dolphinscheduler_version
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_version;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_version()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_version'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_version RENAME t_dolphinscheduler_version;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_version;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_version;
-- ut_dolphin_T_t_dolphinscheduler_worker_group
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_worker_group;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_worker_group()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_worker_group'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_worker_group RENAME t_dolphinscheduler_worker_group;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_worker_group;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_worker_group;
-- ut_dolphin_T_t_dolphinscheduler_worker_server
drop PROCEDURE if EXISTS ut_dolphin_T_t_dolphinscheduler_worker_server;
delimiter d//
CREATE PROCEDURE ut_dolphin_T_t_dolphinscheduler_worker_server()
BEGIN
IF EXISTS (SELECT 1 FROM information_schema.TABLES
WHERE TABLE_NAME='t_escheduler_worker_server'
AND TABLE_SCHEMA=(SELECT DATABASE()))
THEN
ALTER TABLE t_escheduler_worker_server RENAME t_dolphinscheduler_worker_server;
END IF;
END;
d//
delimiter ;
CALL ut_dolphin_T_t_dolphinscheduler_worker_server;
DROP PROCEDURE ut_dolphin_T_t_dolphinscheduler_worker_server;
Loading…
Cancel
Save