16 lines
478 B
Ruby
16 lines
478 B
Ruby
class AlterHomeworkPublishEnd < ActiveRecord::Migration
|
|
def up
|
|
change_column :homework_commons, :publish_time, :datetime
|
|
change_column :homework_commons, :end_time, :datetime
|
|
|
|
HomeworkCommon.all.each do |homework|
|
|
homework.update_column('end_time', homework.end_time + 1.day - 1) unless homework.end_time.nil?
|
|
end
|
|
end
|
|
|
|
def down
|
|
change_column :homework_commons, :publish_time, :date
|
|
change_column :homework_commons, :end_time, :date
|
|
end
|
|
end
|