retrospring/db/migrate/20150112210755_create_groups.rb
nilsding eaa4096af5 Merge branch 'master' into groups
Conflicts:
	db/schema.rb
2015-01-13 07:05:11 +01:00

27 lines
664 B
Ruby

class CreateGroups < ActiveRecord::Migration
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
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
end
end