From 72c65cd7fd6e217268713471a48ca96000fbcd91 Mon Sep 17 00:00:00 2001 From: Adria Navarro Date: Fri, 19 Apr 2024 12:39:04 +0200 Subject: [PATCH] Fix test --- packages/server/src/sdk/app/tables/validation.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/server/src/sdk/app/tables/validation.ts b/packages/server/src/sdk/app/tables/validation.ts index 1609bdfcda..26e1cc8ef2 100644 --- a/packages/server/src/sdk/app/tables/validation.ts +++ b/packages/server/src/sdk/app/tables/validation.ts @@ -40,8 +40,11 @@ function checkForeignKeysAreAutoColumns(datasource: Datasource) { const shouldBeForeign = foreignKeys.find( options => options.tableId === table._id && options.key === column.name ) + if (column.autocolumn) { + continue + } // don't change already auto-columns to it, e.g. primary keys that are foreign - if (shouldBeForeign && !column.autocolumn) { + if (shouldBeForeign) { column.autocolumn = true column.autoReason = AutoReason.FOREIGN_KEY } else if (column.autoReason === AutoReason.FOREIGN_KEY) {