This commit is contained in:
Adria Navarro 2024-05-27 14:31:26 +02:00
parent 4329900a64
commit 1eb929736c
2 changed files with 9 additions and 1 deletions

@ -1 +1 @@
Subproject commit d3c3077011a8e20ed3c48dcd6301caca4120b6ac
Subproject commit d67e126044bde383fb8c316c3c89a37fae74e349

View File

@ -7,6 +7,7 @@ import {
ViewV2Enriched,
} from "@budibase/types"
import { HTTPError, db as dbCore } from "@budibase/backend-core"
import { features } from "@budibase/pro"
import { cloneDeep } from "lodash"
import * as utils from "../../../db/utils"
@ -53,6 +54,13 @@ async function guardViewSchema(
}
if (viewSchema[field].readonly) {
if (!(await features.isViewReadonlyColumnsEnabled())) {
throw new HTTPError(
`Readonly fields are not enabled for your tenant`,
400
)
}
if (isRequired(tableSchemaField.constraints)) {
throw new HTTPError(
`Field "${field}" cannot be readonly as it is a required field`,