OpenProject is the leading open source project management software.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
openproject/db/migrate/001_sti_for_roles.rb

23 lines
673 B

class StiForRoles < ActiveRecord::Migration
def self.up
add_column :roles, :type, :string, :limit => 30, :default => "Role"
ActiveRecord::Base.connection.execute("UPDATE roles SET type='Role';")
create_table :principal_roles, :force => true do |t|
t.column :role_id, :integer, :null => false
t.column :principal_id, :integer, :null => false
t.timestamps
end
add_index :principal_roles, :role_id
add_index :principal_roles, :principal_id
end
def self.down
remove_column :roles, :type
remove_index :principal_roles, :role_id
remove_index :principal_roles, :principal_id
drop_table :principal_roles
end
end