Commit 3752286

mo khan <mo@mokhan.ca>
2016-05-21 15:49:22
add unique constraint to yelp_id index.
1 parent 388e86a
db/migrate/20160521154610_add_unique_constraint_to_yelp_id.rb
@@ -0,0 +1,6 @@
+class AddUniqueConstraintToYelpId < ActiveRecord::Migration
+  def change
+    remove_index :gyms, :yelp_id
+    add_index :gyms, :yelp_id, unique: true
+  end
+end
db/schema.rb
@@ -11,7 +11,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 20160515023751) do
+ActiveRecord::Schema.define(version: 20160521154610) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -48,7 +48,7 @@ ActiveRecord::Schema.define(version: 20160515023751) do
     t.string   "yelp_id"
   end
 
-  add_index "gyms", ["yelp_id"], name: "index_gyms_on_yelp_id", using: :btree
+  add_index "gyms", ["yelp_id"], name: "index_gyms_on_yelp_id", unique: true, using: :btree
 
   create_table "locations", id: :uuid, default: "uuid_generate_v4()", force: :cascade do |t|
     t.uuid     "locatable_id"