Don't use `sdk.tables.getTables` (as it fails randomly)
This commit is contained in:
parent
e61b619740
commit
e364bf5d65
|
@ -254,21 +254,18 @@ export function syncSchema(
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function renameLinkedViews(table: Table, renaming: RenameColumn) {
|
export async function renameLinkedViews(table: Table, renaming: RenameColumn) {
|
||||||
const relatedTableIds = new Set<string>()
|
const relatedTables: Record<string, Table> = {}
|
||||||
|
|
||||||
for (const field of Object.values(table.schema)) {
|
for (const field of Object.values(table.schema)) {
|
||||||
if (field.type !== FieldType.LINK) {
|
if (field.type !== FieldType.LINK) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
relatedTableIds.add(field.tableId)
|
relatedTables[field.tableId] ??= await sdk.tables.getTable(field.tableId)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
const relatedTables = await sdk.tables.getTables(
|
for (const relatedTable of Object.values(relatedTables)) {
|
||||||
Array.from(relatedTableIds.values())
|
|
||||||
)
|
|
||||||
for (const relatedTable of relatedTables) {
|
|
||||||
let toSave = false
|
let toSave = false
|
||||||
const viewsV2 = Object.values(relatedTable.views || {}).filter(
|
const viewsV2 = Object.values(relatedTable.views || {}).filter(
|
||||||
sdk.views.isV2
|
sdk.views.isV2
|
||||||
|
|
Loading…
Reference in New Issue