diff --git a/packages/nc-gui/utils/columnUtils.ts b/packages/nc-gui/utils/columnUtils.ts index 351dec18ad..e6dbf29861 100644 --- a/packages/nc-gui/utils/columnUtils.ts +++ b/packages/nc-gui/utils/columnUtils.ts @@ -168,7 +168,12 @@ const getUIDTIcon = (uidt: UITypes | string) => { ).icon } -const isColumnRequired = (col?: ColumnType) => col && col.rqd && !col.cdf && !col.ai +// treat column as required if `non_null` is true and one of the following is true +// 1. column not having default value +// 2. column is not auto increment +// 3. column is not auto generated +const isColumnRequired = (col?: ColumnType) => col && col.rqd && !col.cdf && !col.ai && !col.meta?.ag + const isVirtualColRequired = (col: ColumnType, columns: ColumnType[]) => col.uidt === UITypes.LinkToAnotherRecord && (col.colOptions).type === RelationTypes.BELONGS_TO &&