Fix types
This commit is contained in:
parent
fe6535a65f
commit
dd373cd5e9
|
@ -15,10 +15,11 @@ function checkForeignKeysAreAutoColumns(datasource: Datasource) {
|
||||||
// make sure all foreign key columns are marked as auto columns
|
// make sure all foreign key columns are marked as auto columns
|
||||||
const foreignKeys: { tableId: string; key: string }[] = []
|
const foreignKeys: { tableId: string; key: string }[] = []
|
||||||
for (let table of tables) {
|
for (let table of tables) {
|
||||||
const relationships = Object.values(table.schema).filter(
|
Object.values(table.schema).forEach(column => {
|
||||||
column => column.type === FieldType.LINK
|
if (column.type !== FieldType.LINK) {
|
||||||
)
|
return
|
||||||
relationships.forEach(relationship => {
|
}
|
||||||
|
const relationship = column
|
||||||
if (relationship.relationshipType === RelationshipType.MANY_TO_MANY) {
|
if (relationship.relationshipType === RelationshipType.MANY_TO_MANY) {
|
||||||
const tableId = relationship.through!
|
const tableId = relationship.through!
|
||||||
foreignKeys.push({ key: relationship.throughTo!, tableId })
|
foreignKeys.push({ key: relationship.throughTo!, tableId })
|
||||||
|
@ -36,8 +37,9 @@ function checkForeignKeysAreAutoColumns(datasource: Datasource) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// now make sure schemas are all accurate
|
// now make sure schemas are all accurate
|
||||||
for (let table of tables) {
|
for (const table of tables) {
|
||||||
for (let column of Object.values(table.schema)) {
|
for (let column of Object.values(table.schema) as any[]) {
|
||||||
|
// TODO: any[]
|
||||||
const shouldBeForeign = foreignKeys.find(
|
const shouldBeForeign = foreignKeys.find(
|
||||||
options => options.tableId === table._id && options.key === column.name
|
options => options.tableId === table._id && options.key === column.name
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue