Handle view schema on table updates

This commit is contained in:
Adria Navarro 2023-08-09 13:26:07 +03:00
parent 51f0860300
commit 4c1747cce4
1 changed files with 9 additions and 1 deletions

View File

@ -9,7 +9,7 @@ import {
fixAutoColumnSubType,
} from "../../../utilities/rowProcessor"
import { runStaticFormulaChecks } from "./bulkFormula"
import { Table } from "@budibase/types"
import { Table, ViewV2 } from "@budibase/types"
import { quotas } from "@budibase/pro"
import isEqual from "lodash/isEqual"
import { cloneDeep } from "lodash/fp"
@ -97,6 +97,14 @@ export async function save(ctx: any) {
const tableView = tableToSave.views[view]
if (!tableView) continue
if (sdk.views.isV2(tableView)) {
tableToSave.views[view] = sdk.views.syncSchema(
oldTable!.views![view] as ViewV2,
tableToSave.schema
)
continue
}
if (tableView.schema.group || tableView.schema.field) continue
tableView.schema = tableToSave.schema
}