ref: master
db/migrate/076_change_role_assignments.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 |
class ChangeRoleAssignments < ActiveRecord::Migration def self.up execute 'DELETE FROM role_assignments WHERE role_id NOT IN (SELECT id FROM roles)' change_column :role_assignments, :accessor_id, :integer, :null => false change_column :role_assignments, :role_id, :integer, :null => false end def self.down change_column :role_assignments, :accessor_id, :integer, :null => true change_column :role_assignments, :role_id, :integer, :null => true end end |