mirror of
https://gitee.com/dromara/mayfly-go
synced 2026-04-24 13:15:20 +08:00
!110 feat: 支持各源数据库导出sql,数据库迁移部分bug修复
* feat: 各源数据库导出 * fix: 数据库迁移 bug修复
This commit is contained in:
@@ -52,7 +52,8 @@ WHERE a.owner = (SELECT SF_GET_SCHEMA_NAME_BY_ID(CURRENT_SCHID))
|
||||
order by a.TABLE_NAME, a.index_name, c.column_position asc
|
||||
---------------------------------------
|
||||
--DM_COLUMN_MA 表列信息
|
||||
select a.table_name as TABLE_NAME,
|
||||
select a.owner,
|
||||
a.table_name as TABLE_NAME,
|
||||
a.column_name as COLUMN_NAME,
|
||||
case when a.NULLABLE = 'Y' then 'YES' when a.NULLABLE = 'N' then 'NO' else 'NO' end as NULLABLE,
|
||||
a.data_type as DATA_TYPE,
|
||||
@@ -61,25 +62,21 @@ select a.table_name
|
||||
a.data_scale as NUM_SCALE,
|
||||
b.comments as COLUMN_COMMENT,
|
||||
a.data_default as COLUMN_DEFAULT,
|
||||
case when t.COL_NAME = a.column_name then 1 else 0 end as IS_IDENTITY,
|
||||
case when t.INFO2 & 0x01 = 0x01 then 1 else 0 end as IS_IDENTITY,
|
||||
case when t2.constraint_type = 'P' then 1 else 0 end as IS_PRIMARY_KEY
|
||||
from all_tab_columns a
|
||||
left join user_col_comments b
|
||||
on b.owner = (SELECT SF_GET_SCHEMA_NAME_BY_ID(CURRENT_SCHID))
|
||||
and b.table_name = a.table_name
|
||||
and a.column_name = b.column_name
|
||||
left join (select b.owner, b.TABLE_NAME, a.NAME as COL_NAME
|
||||
from SYS.SYSCOLUMNS a,
|
||||
SYS.all_tables b,
|
||||
SYS.SYSOBJECTS c
|
||||
where a.INFO2 & 0x01 = 0x01
|
||||
and a.ID = c.ID
|
||||
and c.NAME = b.TABLE_NAME) t
|
||||
on t.table_name = a.table_name and t.owner = a.owner
|
||||
left join (select c1.*, c2.object_name, c2.owner
|
||||
FROM SYS.SYSCOLUMNS c1
|
||||
join SYS.all_objects c2 on c1.id = c2.object_id and c2.object_type = 'TABLE') t
|
||||
on t.object_name = a.table_name and t.owner = a.owner and t.NAME = a.column_name
|
||||
left join (select uc.OWNER, uic.column_name, uic.table_name, uc.constraint_type
|
||||
from user_ind_columns uic
|
||||
left join user_constraints uc on uic.index_name = uc.index_name) t2
|
||||
on t2.table_name = t.table_name and a.column_name = t2.column_name
|
||||
on t2.table_name = t.object_name and a.column_name = t2.column_name and t2.OWNER = a.owner
|
||||
where a.owner = (SELECT SF_GET_SCHEMA_NAME_BY_ID(CURRENT_SCHID))
|
||||
and a.table_name in (%s)
|
||||
order by a.table_name,
|
||||
|
||||
Reference in New Issue
Block a user