Retrospring/db/migrate/20150112210755_create_group...

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
669 B
Ruby
Raw Normal View History

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