Class: AddCamaraderie

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/camaraderie/templates/migration.rb

Instance Method Summary collapse

Instance Method Details

#downObject



17
18
19
# File 'lib/generators/camaraderie/templates/migration.rb', line 17

def down
  drop_table :memberships
end

#upObject



2
3
4
5
6
7
8
9
10
11
12
13
14
15
# File 'lib/generators/camaraderie/templates/migration.rb', line 2

def up
  create_table :memberships do |t|
    t.references :user
    t.references :organization
    t.string :membership_type

    t.timestamps
  end

  add_index "memberships", ["organization_id", "membership_type"], name: "index_memberships_on_organization_id_and_membership_type"
  add_index "memberships", ["organization_id", "user_id", "membership_type"], name: "index_memberships_on_everything", unique: true
  add_index "memberships", ["organization_id"], name: "index_memberships_on_organization_id"
  add_index "memberships", ["user_id"], name: "index_memberships_on_user_id"
end