diff --git a/packages/server/migrations/20230912195046_add-grants-opportunity-status-index.js b/packages/server/migrations/20230912195046_add-grants-opportunity-status-index.js new file mode 100644 index 000000000..484bbebc1 --- /dev/null +++ b/packages/server/migrations/20230912195046_add-grants-opportunity-status-index.js @@ -0,0 +1,15 @@ +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.up = function (knex) { + return knex.raw(`CREATE INDEX IF NOT EXISTS idx_grants_opportunity_status ON grants USING btree (opportunity_status) WHERE (opportunity_status <> 'archived'::text)`); +}; + +/** + * @param { import("knex").Knex } knex + * @returns { Promise } + */ +exports.down = function (knex) { + return knex.raw('DROP INDEX IF EXISTS idx_grants_opportunity_status'); +};