demarches-normaliennes/db/migrate/20170302112312_remove_deposit_datetime_from_dossiers.rb

18 lines
446 B
Ruby
Raw Normal View History

class RemoveDepositDatetimeFromDossiers < ActiveRecord::Migration[5.0]
def change
2017-03-07 16:23:44 +01:00
remove_column :dossiers, :deposit_datetime, :datetime
end
def up
Dossier.where.not(deposit_datetime: nil).each do |dossier|
dossier.update(initiated_at: dossier.deposit_datetime)
end
2017-03-07 16:23:44 +01:00
end
def down
Dossier.where.not(initiated_at: nil).each do |dossier|
dossier.update(deposit_datetime: dossier.initiated_at)
end
end
end