|
|
@ -182,22 +182,25 @@ export class TablesService { |
|
|
|
let result; |
|
|
|
let result; |
|
|
|
try { |
|
|
|
try { |
|
|
|
// delete all relations
|
|
|
|
// delete all relations
|
|
|
|
await Promise.all( |
|
|
|
for (const c of relationColumns) { |
|
|
|
relationColumns.map((c) => { |
|
|
|
|
|
|
|
// skip if column is hasmany relation to mm table
|
|
|
|
// skip if column is hasmany relation to mm table
|
|
|
|
if (c.system) { |
|
|
|
if (c.system) { |
|
|
|
return; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return this.columnsService.columnDelete( |
|
|
|
// verify column exist or not and based on that delete the column
|
|
|
|
|
|
|
|
if (!(await Column.get({ colId: c.id }))) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
await this.columnsService.columnDelete( |
|
|
|
{ |
|
|
|
{ |
|
|
|
req: param.req, |
|
|
|
req: param.req, |
|
|
|
columnId: c.id, |
|
|
|
columnId: c.id, |
|
|
|
}, |
|
|
|
}, |
|
|
|
ncMeta, |
|
|
|
ncMeta, |
|
|
|
); |
|
|
|
); |
|
|
|
}), |
|
|
|
} |
|
|
|
); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const sqlMgr = await ProjectMgrv2.getSqlMgr(project, ncMeta); |
|
|
|
const sqlMgr = await ProjectMgrv2.getSqlMgr(project, ncMeta); |
|
|
|
(table as any).tn = table.table_name; |
|
|
|
(table as any).tn = table.table_name; |
|
|
|