From 64ebdce1b2411fc1035fb51cf3eb7887345fc922 Mon Sep 17 00:00:00 2001 From: Ali BARIN Date: Tue, 3 Sep 2024 13:55:28 +0000 Subject: [PATCH] feat: write migration to make roles unique by key --- .../migrations/20240903110620_make_role_key_unique.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 packages/backend/src/db/migrations/20240903110620_make_role_key_unique.js diff --git a/packages/backend/src/db/migrations/20240903110620_make_role_key_unique.js b/packages/backend/src/db/migrations/20240903110620_make_role_key_unique.js new file mode 100644 index 00000000..666ff0a7 --- /dev/null +++ b/packages/backend/src/db/migrations/20240903110620_make_role_key_unique.js @@ -0,0 +1,11 @@ +export async function up(knex) { + return await knex.schema.alterTable('roles', (table) => { + table.unique('key'); + }); +} + +export async function down(knex) { + return await knex.schema.alterTable('roles', function (table) { + table.dropUnique('key'); + }); +}