Fix autoid numbers
This commit is contained in:
parent
248c44ac2a
commit
3f6d48da1f
|
@ -12,6 +12,7 @@ import {
|
|||
Row,
|
||||
RelationshipType,
|
||||
AutoColumnFieldMetadata,
|
||||
FieldType,
|
||||
} from "@budibase/types"
|
||||
|
||||
export const DEFAULT_JOBS_TABLE_ID = "ta_bb_jobs"
|
||||
|
@ -32,8 +33,12 @@ export const DEFAULT_BB_DATASOURCE = defaultDatasource
|
|||
|
||||
function syncLastIds(table: Table, rowCount: number) {
|
||||
Object.keys(table.schema).forEach(key => {
|
||||
const entry = table.schema[key] as AutoColumnFieldMetadata
|
||||
if (entry.autocolumn && entry.subtype == "autoID") {
|
||||
const entry = table.schema[key]
|
||||
if (
|
||||
entry.autocolumn &&
|
||||
entry.type === FieldType.NUMBER &&
|
||||
entry.subtype == AutoFieldSubTypes.AUTO_ID
|
||||
) {
|
||||
entry.lastID = rowCount
|
||||
}
|
||||
})
|
||||
|
|
|
@ -70,6 +70,7 @@ export interface AutoColumnFieldMetadata
|
|||
export interface NumberFieldMetadata extends Omit<BaseFieldSchema, "subtype"> {
|
||||
type: FieldType.NUMBER
|
||||
subtype?: AutoFieldSubTypes.AUTO_ID
|
||||
lastID?: number
|
||||
autoReason?: AutoReason.FOREIGN_KEY
|
||||
// used specifically when Budibase generates external tables, this denotes if a number field
|
||||
// is a foreign key used for a many-to-many relationship
|
||||
|
|
Loading…
Reference in New Issue