|
|
|
@ -675,44 +675,6 @@ export default class Column<T = any> implements ColumnType {
|
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// check column association with any custom links or LTAR
|
|
|
|
|
if (!isVirtualCol(col)) { |
|
|
|
|
const links = await ncMeta.metaList2( |
|
|
|
|
null, |
|
|
|
|
null, |
|
|
|
|
MetaTable.COL_RELATIONS, |
|
|
|
|
{ |
|
|
|
|
xcCondition: { |
|
|
|
|
_or: [ |
|
|
|
|
{ fk_child_column_id: { eq: id } }, |
|
|
|
|
{ fk_parent_column_id: { eq: id } }, |
|
|
|
|
{ fk_mm_child_column_id: { eq: id } }, |
|
|
|
|
{ fk_mm_parent_column_id: { eq: id } }, |
|
|
|
|
], |
|
|
|
|
}, |
|
|
|
|
}, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
// if custom relation then delete
|
|
|
|
|
if ( |
|
|
|
|
links.every((lk) => { |
|
|
|
|
try { |
|
|
|
|
return parseMetaProp(lk)?.custom; |
|
|
|
|
} catch { |
|
|
|
|
// ignore
|
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
) { |
|
|
|
|
for (const link of links) { |
|
|
|
|
await Column.delete(link.id, ncMeta); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (links.length) { |
|
|
|
|
NcError.columnAssociatedWithLink(id); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// todo: or instead of delete reset related foreign key value to null and handle in BaseModel
|
|
|
|
|
|
|
|
|
|
// get qr code columns and delete
|
|
|
|
|