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/20200708065116_fix_members_...

11 lines
422 B

class FixMembersInconsistencies < ActiveRecord::Migration[6.0]
def change
change_column_default :members, :created_on, -> { 'CURRENT_TIMESTAMP' }
# Update all members without created_on which got created by CTE
Member.where(created_on: nil).update_all(created_on: Time.now)
# Delete members without member_roles
Member.includes(:member_roles).where(member_roles: { id: nil }).destroy_all
end
end