Sha256: 44add16f81137672c286f3fc536a683775aceb95a5ae033d5b909e7308b751a0

Contents?: true

Size: 609 Bytes

Versions: 4

Compression:

Stored size: 609 Bytes

Contents

class CreateTheblogAccountsRoles < ActiveRecord::Migration
  def change
    create_table :theblog_accounts_roles do |t|
      t.references :account, null: false, index: true
      t.references :role,    null: false, index: true

      t.timestamps null: false
    end

    add_index :theblog_accounts_roles, [:account_id, :role_id], unique: true

    add_foreign_key :theblog_accounts_roles,
                    :theblog_roles, column: :role_id
    add_foreign_key :theblog_accounts_roles,
                    Incarnator.account_model.constantize.table_name,
                    column: :account_id
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
theblog-0.0.2.3 db/migrate/20151127183614_create_theblog_accounts_roles.rb
theblog-0.0.2.2 db/migrate/20151127183614_create_theblog_accounts_roles.rb
theblog-0.0.2.1 db/migrate/20151127183614_create_theblog_accounts_roles.rb
theblog-0.0.2 db/migrate/20151127183614_create_theblog_accounts_roles.rb