Class: CreateUserRoles
- Inherits:
-
ActiveRecord::Migration
- Object
- ActiveRecord::Migration
- CreateUserRoles
- Defined in:
- lib/generators/templates/migrations/create_user_roles.rb
Instance Method Summary collapse
Instance Method Details
#change ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 |
# File 'lib/generators/templates/migrations/create_user_roles.rb', line 2 def change create_table :user_roles do |t| t.integer :user_id t.integer :role_id t. end add_index :user_roles, :user_id add_index :user_roles, :role_id add_index :user_roles, [:user_id, :role_id], unique: true end |