From 64bfbea7bddf37dacfeb7f51ecadee60f527fd1f Mon Sep 17 00:00:00 2001 From: cgoodwin90 Date: Fri, 31 May 2024 17:16:53 +1000 Subject: [PATCH] Updated facts sql --- services/api/src/resources/fact/sql.ts | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/services/api/src/resources/fact/sql.ts b/services/api/src/resources/fact/sql.ts index 25bc92fa9d..25121d000f 100644 --- a/services/api/src/resources/fact/sql.ts +++ b/services/api/src/resources/fact/sql.ts @@ -78,12 +78,6 @@ export const Sql = { .where('r.name', '=', name) .andWhere('f.environment', '=', environmentId) .toString(), - selectFactByNameSourceAndEnvironmentId: (name: string, source: string, environmentId: number) => - knex('environment_fact') - .where('name', '=', name) - .andWhere('environment', '=', environmentId) - .andWhere('source', '=', source) - .toString(), selectFactReferencesByFactId: (fid: number) => knex('environment_fact_reference') .where('fid', '=', fid) @@ -91,6 +85,8 @@ export const Sql = { insertFactReference: ({ fid, name }) => knex('environment_fact_reference') .insert({ fid, name }) + .onConflict(['name', 'fid']) + .merge() .toString(), deleteFactReferencesByFactId: (fid) => knex('environment_fact_reference')