2017-03-02 12:41:40 +01:00
|
|
|
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
|
2017-03-02 12:41:40 +01:00
|
|
|
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
|
2017-03-02 12:41:40 +01:00
|
|
|
end
|
|
|
|
end
|