Retrospring/db/migrate/20150108121010_create_group...

18 lines
407 B
Ruby
Raw Normal View History

2015-01-08 04:16:13 -08:00
class CreateGroups < ActiveRecord::Migration
def change
create_table :groups do |t|
t.integer :user_id, null: false
t.integer :target_id, null: false
t.string :name
t.string :display_name
t.timestamps
end
add_index :groups, :user_id
add_index :groups, :target_id
add_index :groups, :name
add_index :groups, [:user_id, :name], unique: true
end
end