Class: CreateMultiRoleAssignments

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

Class Method Summary collapse

Class Method Details

.downObject



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

def self.down
  create_table :role_assignments do |t|
    t.integer :user_id
    t.integer :role_id
    t.timestamps
  end

  create_table :roles do |t|
    t.string :name
    t.timestamps
  end

  add_column :users, :role_assignment_id, :integer
      
end

.upObject



18
19
20
21
22
# File 'lib/generators/auth_assist/templates/remove_multi_role_assignments_migration.rb', line 18

def self.up
  drop_table :role_assignments
  drop_table :roles
  remove_column :users, :role_assignment_id
end