mirror of
https://github.com/mastodon/mastodon.git
synced 2025-01-07 19:05:08 +01:00
fix invalid domain block severities
This commit fixes any invalid domain block severities by setting them to 2 if they are bigger than 2 or 0 if they are smaller than 0. This ensures that the domain block severities are always within the valid range of 0 to 2.
This commit is contained in:
parent
f4b733d454
commit
4a87f697a9
@ -0,0 +1,17 @@
|
|||||||
|
# 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
|
Loading…
Reference in New Issue
Block a user