From 691834d6181fc3a78b0e2968c0475a0541a8fa24 Mon Sep 17 00:00:00 2001 From: Thuc Tran Date: Sat, 22 Jun 2024 22:46:54 -0400 Subject: [PATCH] Add useConstraint modifier to the creation of the unique index. Knex documentation says for the unique() function, that useConstraint will use a unique constraint and is default true for postgres when there is no predicate defined. Issue #3200 specifies that we want a unique index. Documentation can be found here: https://knexjs.org/guide/schema-builder.html#unique --- .../migrations/20240622205204_add-grant-notes-table.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/server/migrations/20240622205204_add-grant-notes-table.js b/packages/server/migrations/20240622205204_add-grant-notes-table.js index 9203b3337..7c39ae7d3 100644 --- a/packages/server/migrations/20240622205204_add-grant-notes-table.js +++ b/packages/server/migrations/20240622205204_add-grant-notes-table.js @@ -13,7 +13,10 @@ exports.up = function (knex) { table.foreign('grant_id').references('grants.grant_id'); table.foreign('user_id').references('users.id'); - table.unique(['grant_id', 'user_id'], 'idx_grant_id_user_id'); + table.unique(['grant_id', 'user_id'], { + indexName: 'idx_grant_id_user_id', + useConstraint: false, + }); }) .createTable('grant_notes_revisions', (table) => { table.increments('id').notNullable().primary();