mirror of
https://github.com/mastodon/mastodon.git
synced 2025-02-03 16:01:57 +01:00
18 lines
400 B
Ruby
18 lines
400 B
Ruby
|
# frozen_string_literal: true
|
||
|
|
||
|
class FixInvalidDomainBlockSeverities < ActiveRecord::Migration[7.1]
|
||
|
disable_ddl_transaction!
|
||
|
|
||
|
def up
|
||
|
safety_assured do
|
||
|
execute <<~SQL.squish
|
||
|
UPDATE domain_blocks
|
||
|
SET severity = CASE WHEN severity > 2 THEN 2 WHEN severity < 0 THEN 0 END
|
||
|
WHERE severity > 2 OR severity < 0 RETURNING id;
|
||
|
SQL
|
||
|
end
|
||
|
end
|
||
|
|
||
|
def down; end
|
||
|
end
|