Respond to PR feedback.
This commit is contained in:
parent
99ecefaedf
commit
703092505d
|
@ -9,8 +9,6 @@ import {
|
||||||
Row,
|
Row,
|
||||||
RowAttachment,
|
RowAttachment,
|
||||||
Table,
|
Table,
|
||||||
isAutoColumnField,
|
|
||||||
isAutoColumnNumberField,
|
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import {
|
import {
|
||||||
|
@ -41,7 +39,7 @@ async function getNextAutoId(
|
||||||
const db = context.getAppDB()
|
const db = context.getAppDB()
|
||||||
for (let attempt = 0; attempt < 5; attempt++) {
|
for (let attempt = 0; attempt < 5; attempt++) {
|
||||||
const schema = table.schema[column]
|
const schema = table.schema[column]
|
||||||
if (!isAutoColumnField(schema) && !isAutoColumnNumberField(schema)) {
|
if (schema.type !== FieldType.NUMBER && schema.type !== FieldType.AUTO) {
|
||||||
throw new Error(`Column ${column} is not an auto column`)
|
throw new Error(`Column ${column} is not an auto column`)
|
||||||
}
|
}
|
||||||
schema.lastID = (schema.lastID || 0) + 1
|
schema.lastID = (schema.lastID || 0) + 1
|
||||||
|
|
|
@ -219,15 +219,3 @@ export function isAttachmentField(
|
||||||
): field is AttachmentFieldMetadata {
|
): field is AttachmentFieldMetadata {
|
||||||
return field.type === FieldType.ATTACHMENTS
|
return field.type === FieldType.ATTACHMENTS
|
||||||
}
|
}
|
||||||
|
|
||||||
export function isAutoColumnField(
|
|
||||||
field: FieldSchema
|
|
||||||
): field is AutoColumnFieldMetadata {
|
|
||||||
return field.type === FieldType.AUTO
|
|
||||||
}
|
|
||||||
|
|
||||||
export function isAutoColumnNumberField(
|
|
||||||
field: FieldSchema
|
|
||||||
): field is NumberFieldMetadata {
|
|
||||||
return field.type === FieldType.NUMBER
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue