Sha256: d32ed0697bdd238c2f11ffd0531ca2f272c8adefc72601a6ac4f58691e6d373a

Contents?: true

Size: 709 Bytes

Versions: 3

Compression:

Stored size: 709 Bytes

Contents

class CreateClubhouseMemberships < ActiveRecord::Migration
  def change
    create_table :clubhouse_memberships, id: :uuid do |t|
      t.uuid :member_id, null: false
      t.uuid :organization_id, null: false
      t.boolean :admin, null: false, default: false

      t.timestamps null: false
    end

    add_foreign_key :clubhouse_memberships, :users, column: :member_id, on_delete: :cascade
    add_foreign_key :clubhouse_memberships, :clubhouse_organizations, column: :organization_id, on_delete: :cascade

    add_index :clubhouse_memberships, :member_id
    add_index :clubhouse_memberships, :organization_id
    add_index :clubhouse_memberships, [:member_id, :organization_id], unique: true
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
clubhouse-0.3.0 db/migrate/20150226173731_create_clubhouse_memberships.rb
clubhouse-0.2.0 db/migrate/20150226173731_create_clubhouse_memberships.rb
clubhouse-0.1.0 db/migrate/20150226173731_create_clubhouse_memberships.rb