mirror of
https://gitee.com/huangge1199_admin/vue-pro.git
synced 2024-11-22 15:21:53 +08:00
feat: 创建虚拟dual表,达梦脚本优化
This commit is contained in:
parent
774082509b
commit
65651fb1ed
@ -5,10 +5,19 @@
|
||||
|
||||
Target Server Type : PostgreSQL
|
||||
|
||||
Date: 2024-05-01 23:25:45
|
||||
Date: 2024-05-03 23:36:19
|
||||
*/
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for dual
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS dual;
|
||||
CREATE TABLE dual
|
||||
(
|
||||
);
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for infra_api_access_log
|
||||
-- ----------------------------
|
||||
@ -3866,7 +3875,6 @@ COMMENT ON COLUMN system_sms_code.updater IS '更新者';
|
||||
COMMENT ON COLUMN system_sms_code.update_time IS '更新时间';
|
||||
COMMENT ON COLUMN system_sms_code.deleted IS '是否删除';
|
||||
COMMENT ON COLUMN system_sms_code.tenant_id IS '租户编号';
|
||||
COMMENT ON COLUMN system_sms_code.idx_mobile IS '手机号';
|
||||
COMMENT ON TABLE system_sms_code IS '手机验证码';
|
||||
|
||||
DROP SEQUENCE IF EXISTS system_sms_code_seq;
|
||||
@ -4703,3 +4711,4 @@ COMMIT;
|
||||
DROP SEQUENCE IF EXISTS yudao_demo03_student_seq;
|
||||
CREATE SEQUENCE yudao_demo03_student_seq
|
||||
START 10;
|
||||
|
||||
|
@ -5,10 +5,29 @@
|
||||
|
||||
Target Server Type : Microsoft SQL Server
|
||||
|
||||
Date: 2024-05-02 15:29:31
|
||||
Date: 2024-05-03 23:36:38
|
||||
*/
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for dual
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS dual
|
||||
GO
|
||||
|
||||
CREATE TABLE dual
|
||||
(
|
||||
id int NULL
|
||||
)
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'数据库连接的表',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'dual'
|
||||
GO
|
||||
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for infra_api_access_log
|
||||
-- ----------------------------
|
||||
|
@ -54,7 +54,8 @@ docker load -i dm8_20230808_rev197096_x86_rh6_64_single.tar
|
||||
```Bash
|
||||
docker compose up -d dm8
|
||||
# 注意:启动完 sqlserver 后,需要手动再执行如下命令,因为 SQL Server 不支持初始化脚本
|
||||
docker compose exec -i dm8 /bin/bash -c "exec /opt/dmdbms/bin/disql SYSDBA/SYSDBA001 \`/tmp/schema.sql"
|
||||
docker compose exec dm8 bash -c "exec /opt/dmdbms/bin/disql SYSDBA/SYSDBA001 \`/tmp/schema.sql"
|
||||
exit
|
||||
```
|
||||
|
||||
**注意**: `sql/dm/ruoyi-vue-pro-dm8.sql`文件编码必须为`GBK`或者`GBK`超集
|
||||
|
@ -134,6 +134,14 @@ class Convertor(ABC):
|
||||
"""
|
||||
pass
|
||||
|
||||
def gen_dual(self) -> str:
|
||||
"""生成虚拟 dual 表
|
||||
|
||||
Returns:
|
||||
str: 生成脚本, 默认返回空脚本, 表示当前数据库无需手工创建
|
||||
"""
|
||||
return ""
|
||||
|
||||
@staticmethod
|
||||
def inserts(table_name: str, script_content: str) -> Generator:
|
||||
PREFIX = f"INSERT INTO `{table_name}`"
|
||||
@ -192,6 +200,17 @@ class Convertor(ABC):
|
||||
)
|
||||
)
|
||||
|
||||
dual = self.gen_dual()
|
||||
if dual:
|
||||
print(
|
||||
f"""-- ----------------------------
|
||||
-- Table structure for dual
|
||||
-- ----------------------------
|
||||
{dual}
|
||||
|
||||
"""
|
||||
)
|
||||
|
||||
error_scripts = []
|
||||
for table_sql in self.table_script_list:
|
||||
ddl = DDLParser(table_sql.replace("`", "")).run()
|
||||
@ -348,6 +367,12 @@ CREATE SEQUENCE {table_name}_seq
|
||||
|
||||
return script
|
||||
|
||||
def gen_dual(self) -> str:
|
||||
return """DROP TABLE IF EXISTS dual;
|
||||
CREATE TABLE dual
|
||||
(
|
||||
);"""
|
||||
|
||||
|
||||
class OracleConvertor(Convertor):
|
||||
def __init__(self, src):
|
||||
@ -605,6 +630,22 @@ GO
|
||||
|
||||
return script
|
||||
|
||||
def gen_dual(self) -> str:
|
||||
return """DROP TABLE IF EXISTS dual
|
||||
GO
|
||||
|
||||
CREATE TABLE dual
|
||||
(
|
||||
id int NULL
|
||||
)
|
||||
GO
|
||||
|
||||
EXEC sp_addextendedproperty
|
||||
'MS_Description', N'数据库连接的表',
|
||||
'SCHEMA', N'dbo',
|
||||
'TABLE', N'dual'
|
||||
GO"""
|
||||
|
||||
|
||||
class DM8Convertor(Convertor):
|
||||
def __init__(self, src):
|
||||
|
@ -91,4 +91,4 @@ services:
|
||||
volumes:
|
||||
- dm8:/opt/dmdbms/data
|
||||
- ../dm/ruoyi-vue-pro-dm8.sql:/tmp/schema.sql:ro
|
||||
# docker compose exec -i dm8 /bin/bash -c "exec /opt/dmdbms/bin/disql SYSDBA/SYSDBA001 \`/tmp/schema.sql"
|
||||
# docker compose exec dm8 bash -c "exec /opt/dmdbms/bin/disql SYSDBA/SYSDBA001 \`/tmp/schema.sql"
|
||||
|
Loading…
Reference in New Issue
Block a user