2020-09-16 23:35:29 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class ChangeUploadsVerifiedToInteger < ActiveRecord::Migration[6.0]
|
|
|
|
def up
|
|
|
|
add_column :uploads, :verification_status, :integer, null: false, default: 1
|
|
|
|
Migration::ColumnDropper.mark_readonly(:uploads, :verified)
|
|
|
|
|
|
|
|
DB.exec(<<~SQL)
|
|
|
|
UPDATE uploads SET verification_status = CASE WHEN
|
|
|
|
verified THEN 2
|
|
|
|
WHEN NOT verified THEN 3
|
2020-09-17 00:23:37 -04:00
|
|
|
ELSE 1
|
2020-09-16 23:35:29 -04:00
|
|
|
END
|
|
|
|
SQL
|
|
|
|
end
|
|
|
|
|
|
|
|
def down
|
|
|
|
remove_column :uploads, :verification_status
|
|
|
|
end
|
|
|
|
end
|