summaryrefslogtreecommitdiff
path: root/db
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2016-05-21 09:49:22 -0600
committermo khan <mo@mokhan.ca>2016-05-21 09:49:22 -0600
commit37522868c812b392d49394271ffce1cbcdc82a10 (patch)
treebc0a965e8b0b79f881652b68f6fe39d1390116e9 /db
parent388e86afe55c25a7c48ee5889a2dbf90c07f4c0c (diff)
add unique constraint to yelp_id index.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20160521154610_add_unique_constraint_to_yelp_id.rb6
-rw-r--r--db/schema.rb4
2 files changed, 8 insertions, 2 deletions
diff --git a/db/migrate/20160521154610_add_unique_constraint_to_yelp_id.rb b/db/migrate/20160521154610_add_unique_constraint_to_yelp_id.rb
new file mode 100644
index 0000000..77ca126
--- /dev/null
+++ b/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
diff --git a/db/schema.rb b/db/schema.rb
index 73914d1..30c67a0 100644
--- a/db/schema.rb
+++ b/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"