From b7ba2e06036d80a6eec0f8edfebc733f942496ff Mon Sep 17 00:00:00 2001 From: Max Wofford Date: Tue, 4 Mar 2025 16:49:27 -0500 Subject: [PATCH] Update api keys migration to check for existing index --- db/migrate/20250303175821_create_api_keys.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/db/migrate/20250303175821_create_api_keys.rb b/db/migrate/20250303175821_create_api_keys.rb index a9d9846..d243404 100644 --- a/db/migrate/20250303175821_create_api_keys.rb +++ b/db/migrate/20250303175821_create_api_keys.rb @@ -8,8 +8,8 @@ class CreateApiKeys < ActiveRecord::Migration[8.0] t.timestamps end - add_index :api_keys, :token, unique: true - add_index :api_keys, [ :user_id, :token ], unique: true - add_index :api_keys, [ :user_id, :name ], unique: true + add_index :api_keys, :token, unique: true, if_not_exists: true + add_index :api_keys, [ :user_id, :token ], unique: true, if_not_exists: true + add_index :api_keys, [ :user_id, :name ], unique: true, if_not_exists: true end end