Merge pull request #8125 from Budibase/fix/table-options-csv
Fixing options type import with CSV
This commit is contained in:
commit
3f4bdece64
|
@ -22,7 +22,7 @@ export async function addRev(
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a case insensitive search on the provided documents, using the
|
* Performs a case in-sensitive search on the provided documents, using the
|
||||||
* provided key and value. This will be a string based search, using the
|
* provided key and value. This will be a string based search, using the
|
||||||
* startsWith function.
|
* startsWith function.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -14,8 +14,10 @@ import {
|
||||||
fixAutoColumnSubType,
|
fixAutoColumnSubType,
|
||||||
} from "../../../utilities/rowProcessor"
|
} from "../../../utilities/rowProcessor"
|
||||||
import { runStaticFormulaChecks } from "./bulkFormula"
|
import { runStaticFormulaChecks } from "./bulkFormula"
|
||||||
import { Table } from "../../../definitions/common"
|
import { Table } from "@budibase/types"
|
||||||
import { quotas } from "@budibase/pro"
|
import { quotas } from "@budibase/pro"
|
||||||
|
import { isEqual } from "lodash"
|
||||||
|
import { cloneDeep } from "lodash/fp"
|
||||||
|
|
||||||
function checkAutoColumns(table: Table, oldTable: Table) {
|
function checkAutoColumns(table: Table, oldTable: Table) {
|
||||||
if (!table.schema) {
|
if (!table.schema) {
|
||||||
|
@ -123,10 +125,16 @@ export async function save(ctx: any) {
|
||||||
if (updatedRows && updatedRows.length !== 0) {
|
if (updatedRows && updatedRows.length !== 0) {
|
||||||
await db.bulkDocs(updatedRows)
|
await db.bulkDocs(updatedRows)
|
||||||
}
|
}
|
||||||
const result = await db.put(tableToSave)
|
let result = await db.put(tableToSave)
|
||||||
tableToSave._rev = result.rev
|
tableToSave._rev = result.rev
|
||||||
|
const savedTable = cloneDeep(tableToSave)
|
||||||
|
|
||||||
tableToSave = await tableSaveFunctions.after(tableToSave)
|
tableToSave = await tableSaveFunctions.after(tableToSave)
|
||||||
|
// the table may be updated as part of the table save after functionality - need to write it
|
||||||
|
if (!isEqual(savedTable, tableToSave)) {
|
||||||
|
result = await db.put(tableToSave)
|
||||||
|
tableToSave._rev = result.rev
|
||||||
|
}
|
||||||
// has to run after, make sure it has _id
|
// has to run after, make sure it has _id
|
||||||
await runStaticFormulaChecks(tableToSave, { oldTable, deletion: null })
|
await runStaticFormulaChecks(tableToSave, { oldTable, deletion: null })
|
||||||
return tableToSave
|
return tableToSave
|
||||||
|
|
|
@ -245,7 +245,7 @@ class TableSaveFunctions {
|
||||||
// after saving
|
// after saving
|
||||||
async after(table: any) {
|
async after(table: any) {
|
||||||
table = await handleSearchIndexes(table)
|
table = await handleSearchIndexes(table)
|
||||||
await handleDataImport(this.user, table, this.dataImport)
|
table = await handleDataImport(this.user, table, this.dataImport)
|
||||||
return table
|
return table
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue