1. 扩展 SQL 转换工具的达梦支持
2. 补全除系统基础模块外额外功能模块 sql 脚本 3. 统一设置测试环境 xxl job 配置
This commit is contained in:
@@ -631,10 +631,10 @@ GO
|
||||
-- @formatter:off
|
||||
BEGIN TRANSACTION
|
||||
GO
|
||||
SET IDENTITY_INSERT {table_name.lower()} ON
|
||||
-- SET IDENTITY_INSERT {table_name.lower()} ON
|
||||
GO
|
||||
{inserts_lines}
|
||||
SET IDENTITY_INSERT {table_name.lower()} OFF
|
||||
-- SET IDENTITY_INSERT {table_name.lower()} OFF
|
||||
GO
|
||||
COMMIT
|
||||
GO
|
||||
@@ -692,6 +692,12 @@ class DM8Convertor(Convertor):
|
||||
return "blob"
|
||||
if type == "mediumblob":
|
||||
return "varchar(10240)"
|
||||
if type == "double":
|
||||
return "double"
|
||||
if type == "json":
|
||||
return "clob"
|
||||
if type == "longtext":
|
||||
return "clob"
|
||||
if type == "decimal":
|
||||
return (
|
||||
f"decimal({','.join(str(s) for s in size)})" if len(size) else "decimal"
|
||||
@@ -705,6 +711,9 @@ class DM8Convertor(Convertor):
|
||||
if name == "id":
|
||||
# 默认不生成自增,使用分布式 Id
|
||||
return "id bigint NOT NULL PRIMARY KEY "
|
||||
if name == "percent":
|
||||
# percent 是 dm 保留关键字,需要用双引号包裹
|
||||
return '"percent" decimal(24, 6) NOT NULL DEFAULT 0'
|
||||
|
||||
type = col["type"].lower()
|
||||
full_type = self.translate_type(type, col["size"])
|
||||
@@ -733,6 +742,10 @@ CREATE TABLE {table_name} (
|
||||
def gen_comment(self, table_sql: str, table_name: str) -> str:
|
||||
script = ""
|
||||
for field, comment_string in self.filed_comments(table_sql):
|
||||
# 存在 percent 关键字需要双引号包裹
|
||||
if field.lower() == "percent":
|
||||
script = script.replace(f'{table_name}.percent', f'{table_name}."percent"')
|
||||
continue
|
||||
script += (
|
||||
f"COMMENT ON COLUMN {table_name}.{field} IS '{comment_string}';" + "\n"
|
||||
)
|
||||
@@ -762,12 +775,13 @@ CREATE TABLE {table_name} (
|
||||
-- Records of {table_name.lower()}
|
||||
-- ----------------------------
|
||||
-- @formatter:off
|
||||
SET IDENTITY_INSERT {table_name.lower()} ON;
|
||||
-- SET IDENTITY_INSERT {table_name.lower()} ON;
|
||||
{inserts_lines}
|
||||
COMMIT;
|
||||
SET IDENTITY_INSERT {table_name.lower()} OFF;
|
||||
-- SET IDENTITY_INSERT {table_name.lower()} OFF;
|
||||
-- @formatter:on"""
|
||||
|
||||
script = script.replace(" percent,",' "percent",')
|
||||
script = script.replace("\\'","''")
|
||||
return script
|
||||
|
||||
|
||||
@@ -823,7 +837,7 @@ def main():
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
sql_file = pathlib.Path("../mysql/ruoyi-vue-pro.sql").resolve().as_posix()
|
||||
sql_file = pathlib.Path("../mysql/ai.sql").resolve().as_posix()
|
||||
convertor = None
|
||||
if args.type == "postgres":
|
||||
convertor = PostgreSQLConvertor(sql_file)
|
||||
|
||||
Reference in New Issue
Block a user