Skip to content

Commit

Permalink
Merge 756d290 into ce67e99
Browse files Browse the repository at this point in the history
  • Loading branch information
fj committed Jan 26, 2015
2 parents ce67e99 + 756d290 commit 66f16ee
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,16 @@ Schema_plus_index adds various convenient capabilities to `ActiveRecord`'s index

* Adds shorthands to the `:index` option in migrations

create_table :parts do |t|
t.string :role, index: true # shorthand for index: {}
t.string :product_code, index: :unique # shorthand for index: { unique: true }
t.string :first_name
t.string :last_name, index: { with: :first_name } # multi-column index

t.string :country_code
t.string :area_code
t.string :local_number, index: { with: [:country_code, :area_code] } # multi-column index
end
create_table :parts do |t|
t.string :role, index: true # shorthand for index: {}
t.string :product_code, index: :unique # shorthand for index: { unique: true }
t.string :first_name
t.string :last_name, index: { with: :first_name } # multi-column index

t.string :country_code
t.string :area_code
t.string :local_number, index: { with: [:country_code, :area_code] } # multi-column index
end

Of course options can be combined, such as `index: { with: :first_name, unique: true, name: "my_index"}`

Expand Down

0 comments on commit 66f16ee

Please sign in to comment.