From 6648e548c51308f9d3f88d0c5bbb7a452709e6be Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 6 Jul 2021 13:55:05 +0100 Subject: [PATCH] Quick fix, make sure auto-columns never sent to DB. --- packages/server/src/api/controllers/row/ExternalRequest.ts | 2 +- packages/server/src/integrations/tests/postgres.spec.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/server/src/api/controllers/row/ExternalRequest.ts b/packages/server/src/api/controllers/row/ExternalRequest.ts index 855c64e4c1..c5fad441bf 100644 --- a/packages/server/src/api/controllers/row/ExternalRequest.ts +++ b/packages/server/src/api/controllers/row/ExternalRequest.ts @@ -162,7 +162,7 @@ module External { manyRelationships: ManyRelationship[] = [] for (let [key, field] of Object.entries(table.schema)) { // if set already, or not set just skip it - if (!row[key] || newRow[key]) { + if (!row[key] || newRow[key] || field.autocolumn) { continue } // if its not a link then just copy it over diff --git a/packages/server/src/integrations/tests/postgres.spec.js b/packages/server/src/integrations/tests/postgres.spec.js index 348fa20b6f..f973f69101 100644 --- a/packages/server/src/integrations/tests/postgres.spec.js +++ b/packages/server/src/integrations/tests/postgres.spec.js @@ -17,7 +17,7 @@ describe("Postgres Integration", () => { it("calls the create method with the correct params", async () => { const sql = "insert into users (name, age) values ('Joe', 123);" - const response = await config.integration.create({ + await config.integration.create({ sql }) expect(pg.queryMock).toHaveBeenCalledWith(sql, {}) @@ -25,7 +25,7 @@ describe("Postgres Integration", () => { it("calls the read method with the correct params", async () => { const sql = "select * from users;" - const response = await config.integration.read({ + await config.integration.read({ sql }) expect(pg.queryMock).toHaveBeenCalledWith(sql, {})