Skip to content

Instantly share code, notes, and snippets.

@uptownhr
Created May 1, 2015 17:36
Show Gist options
  • Save uptownhr/8a204648bf0f05fb8aae to your computer and use it in GitHub Desktop.
Save uptownhr/8a204648bf0f05fb8aae to your computer and use it in GitHub Desktop.
unique index not working
Sequel.migration do
up do
create_table :locations do
primary_key :id
String :address
String :lat
String :long
DateTime :created_at
DateTime :updated_at
end
add_index :locations, [:address, :lat, :long], :unique => true
end
down do
drop_table :corporations
end
end
@uptownhr
Copy link
Author

uptownhr commented May 1, 2015

migration log

INFO -  Begin applying migration version 3, direction: up
   INFO -  (0.007078s) BEGIN
   INFO -  (0.009243s) CREATE TABLE "locations" ("id" serial PRIMARY KEY, "address" text, "lat" text, "long" text, "created_at" timestamp, "updated_at" timestamp)
   INFO -  (0.009447s) CREATE UNIQUE INDEX "locations_address_lat_long_index" ON "locations" ("address", "lat", "long")
   INFO -  (0.001128s) UPDATE "schema_info" SET "version" = 3
   INFO -  (0.007561s) COMMIT
   INFO -  Finished applying migration version 3, direction: up, took 0.037248 seconds

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment