-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
LTI-366: complementary fixes for issue with codes already used error (#…
…311) * LTI-366 remove uniqueness from codes in Room table * LTI-366: updated schema with last migration * LTI-366: hot-fix and followup * LTI-366: remove uniqueness validation from model
- Loading branch information
Showing
4 changed files
with
23 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
db/migrate/20240507174455_remove_unique_index_from_rooms.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
class RemoveUniqueIndexFromRooms < ActiveRecord::Migration[6.1] | ||
def up | ||
# Remove the existing unique index | ||
remove_index(:rooms, :code, unique: true, if_exists: true) | ||
# Add a non-unique index | ||
add_index(:rooms, :code, name: 'index_rooms_on_code') | ||
end | ||
|
||
def down | ||
# Remove the non-unique index | ||
remove_index(:rooms, name: 'index_rooms_on_code', if_exists: true) | ||
# Re-add the unique index | ||
add_index(:rooms, :code, unique: true, name: 'index_rooms_on_code_unique') | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters