mirror of
https://github.com/certd/certd.git
synced 2026-04-03 14:10:54 +08:00
chore: 自动转换mysql表格engine
This commit is contained in:
@@ -0,0 +1,36 @@
|
|||||||
|
|
||||||
|
ALTER TABLE `cd_access` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_addon` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_cert_info` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_cname_provider` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_cname_record` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_domain` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_group` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_oauth_bound` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_open_key` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_product` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_site_info` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_site_ip` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_trade` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_user_suite` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `flyway_history` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `pi_history` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `pi_history_log` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `pi_notification` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `pi_pipeline` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `pi_pipeline_group` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `pi_plugin` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `pi_storage` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `pi_sub_domain` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `pi_template` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `sys_permission` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `sys_role` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `sys_role_permission` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `sys_settings` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `sys_user` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `sys_user_role` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `user_settings` ENGINE = InnoDB;
|
||||||
|
|
||||||
|
ALTER TABLE `cd_audit_log` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_project` ENGINE = InnoDB;
|
||||||
|
ALTER TABLE `cd_project_member` ENGINE = InnoDB;
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
|
||||||
@@ -75,8 +75,24 @@ function transformMysql() {
|
|||||||
pgSql = pgSql.replaceAll(/text/g, 'longtext');
|
pgSql = pgSql.replaceAll(/text/g, 'longtext');
|
||||||
//双引号 替换成反引号
|
//双引号 替换成反引号
|
||||||
pgSql = pgSql.replaceAll(/"/g, '`');
|
pgSql = pgSql.replaceAll(/"/g, '`');
|
||||||
//create table if not exists
|
|
||||||
pgSql = pgSql.replaceAll(/CREATE TABLE ([ ]+)`/g, 'CREATE TABLE IF NOT EXISTS `');
|
|
||||||
|
//提取所有的 create table 的表格name
|
||||||
|
const tableNames = pgSql.match(/CREATE TABLE `([^`]*)`/g);
|
||||||
|
if (tableNames && tableNames.length > 0) {
|
||||||
|
for (const item of tableNames) {
|
||||||
|
/**
|
||||||
|
* CREATE TABLE `cd_project`
|
||||||
|
CREATE TABLE `cd_project_member`
|
||||||
|
CREATE TABLE `cd_audit_log`
|
||||||
|
*/
|
||||||
|
//提取表名
|
||||||
|
const tableName = item.match(/`([^`]*)`/)[1];
|
||||||
|
pgSql += `\nALTER TABLE \`${tableName}\` ENGINE = InnoDB;`
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
fs.writeFileSync(`./migration-mysql/${notFile}`, pgSql);
|
fs.writeFileSync(`./migration-mysql/${notFile}`, pgSql);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user