Skip to content

Commit

Permalink
Remove useless index
Browse files Browse the repository at this point in the history
  • Loading branch information
Calyhre committed Jun 6, 2017
1 parent d5542f6 commit f3753bf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/models/game.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ class Game < ApplicationRecord
attribute :release_date, :datetime
attribute :cover_url, :string

validates :game_code, format: { with: GAME_CODE_FORMAT }
validates :region, inclusion: { in: REGIONS }
validates :game_code, format: { with: GAME_CODE_FORMAT }, allow_nil: true
validates :nsuid, format: { with: NSUID_CODE_FORMAT }, allow_nil: true

has_many :prices
Expand Down
5 changes: 5 additions & 0 deletions db/migrate/20170606195755_change_game_indexes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ChangeGameIndexes < ActiveRecord::Migration[5.1]
def change
remove_index :games, column: %i[game_code region], unique: true
end
end
3 changes: 1 addition & 2 deletions db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20170520131614) do
ActiveRecord::Schema.define(version: 20170606195755) do

# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
Expand All @@ -25,7 +25,6 @@
t.string "cover_url"
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.index ["game_code", "region"], name: "index_games_on_game_code_and_region", unique: true
t.index ["game_code"], name: "index_games_on_game_code"
t.index ["nsuid"], name: "index_games_on_nsuid"
end
Expand Down

0 comments on commit f3753bf

Please sign in to comment.