mirror of
https://github.com/discourse/discourse.git
synced 2024-11-25 05:40:42 +08:00
c2a660ead3
* Missing ELSE 1 even though there is a default on the column.
23 lines
514 B
Ruby
23 lines
514 B
Ruby
# 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
|
|
ELSE 1
|
|
END
|
|
SQL
|
|
)
|
|
end
|
|
|
|
def down
|
|
remove_column :uploads, :verification_status
|
|
end
|
|
end
|