discourse/db/post_migrate/20230117143451_drop_invalid_drafts.rb
Natalie Tay f91ac52a22
SECURITY: Limit the length of drafts (#19989)
Co-authored-by: Loïc Guitaut <loic@discourse.org>
2023-01-25 13:50:21 +02:00

15 lines
251 B
Ruby

# frozen_string_literal: true
class DropInvalidDrafts < ActiveRecord::Migration[7.0]
def up
execute <<~SQL
DELETE FROM drafts
WHERE LENGTH(data) > 400000
SQL
end
def down
raise ActiveRecord::IrreversibleMigration
end
end