Show More
Commit Description:
update migration
Commit Description:
update migration
References:
File last commit:
Show/Diff file:
Action:
db/migrate/006_create_roles.rb
| 19 lines
| 538 B
| text/x-ruby
| RubyLexer
|
r822 | class CreateRoles < ActiveRecord::Migration[4.2] | |||
|
r0 | def self.up | ||
r822 | create_table :roles, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| | |||
|
r0 | t.column 'name', :string | ||
end | ||||
r822 | create_table :roles_users, :id => false, options: "ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci" do |t| | |||
|
r0 | t.column 'role_id', :integer | ||
t.column 'user_id', :integer | ||||
end | ||||
add_index :roles_users, :user_id | ||||
end | ||||
def self.down | ||||
drop_table :roles_users | ||||
drop_table :roles | ||||
end | ||||
end | ||||