Class: SunriseCreateRoles

Inherits:
ActiveRecord::Migration
  • Object
show all
Defined in:
lib/generators/sunrise/templates/migrate/create_roles.rb

Class Method Summary collapse

Class Method Details

.downObject



13
14
15
# File 'lib/generators/sunrise/templates/migrate/create_roles.rb', line 13

def self.down
  drop_table :roles
end

.upObject



2
3
4
5
6
7
8
9
10
11
# File 'lib/generators/sunrise/templates/migrate/create_roles.rb', line 2

def self.up
  create_table :roles do |t|
    t.integer :role_type, :limit => 1, :default => 0
    t.integer :user_id, :null => false
    
    t.timestamps
  end
  
  add_index :roles, :user_id, :name => "fk_user"
end