1
0
Fork 0
mirror of synced 2024-06-01 10:09:48 +12:00
budibase/qa-core/src/internal-api/fixtures/tables.ts

31 lines
643 B
TypeScript
Raw Normal View History

2022-10-19 22:35:00 +13:00
import { Table } from "@budibase/types"
2022-10-19 05:29:13 +13:00
export const generateTable = (): Table => {
2022-10-25 21:02:55 +13:00
return {
name: "Test Table",
schema: {},
sourceId: "bb_internal",
type: "internal",
}
2022-10-19 05:29:13 +13:00
}
export const generateNewColumnForTable = (tableData: any): Table => {
2022-10-25 21:02:55 +13:00
const newColumn = tableData
newColumn.schema = {
TestColumn: {
type: "string",
name: "TestColumn",
constraints: {
presence: { allowEmpty: false },
length: { maximum: null },
type: "string",
},
},
}
newColumn.indexes = {
0: "TestColumn",
}
newColumn.updatedAt = new Date().toISOString()
return newColumn
2022-10-19 05:29:13 +13:00
}