Browse Source

fix: block deletion of system column

pull/7304/head
Pranav C 10 months ago
parent
commit
f7be2c6597
  1. 14
      packages/nocodb/src/services/columns.service.ts

14
packages/nocodb/src/services/columns.service.ts

@ -2031,6 +2031,15 @@ export class ColumnsService {
const reuse = param.reuse || {};
const column = await Column.get({ colId: param.columnId }, ncMeta);
if (column.system) {
NcError.badRequest(
`The column '${
column.title || column.column_name
}' is a system column and cannot be deleted.`,
);
}
const table = await reuseOrSave('table', reuse, async () =>
Model.getWithInfo(
{
@ -2216,11 +2225,6 @@ export class ColumnsService {
case UITypes.CreatedTime:
case UITypes.LastModifiedTime:
{
if (column.system) {
NcError.badRequest(
`The column '${column.column_name}' is a system column and cannot be deleted.`,
);
}
await Column.delete(param.columnId, ncMeta);
}
break;

Loading…
Cancel
Save