mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
This commit promotes all post_deploy migrations which existed in Discourse v3.3.0 (timestamp <= 20240717053710)
21 lines
437 B
Ruby
21 lines
437 B
Ruby
# frozen_string_literal: true
|
|
|
|
class ClearOrphanedDraftUploadReferences < ActiveRecord::Migration[7.0]
|
|
def up
|
|
execute <<~SQL
|
|
DELETE
|
|
FROM
|
|
"upload_references"
|
|
WHERE
|
|
"upload_references"."target_type" = 'Draft' AND
|
|
"upload_references"."target_id" NOT IN (
|
|
SELECT "drafts"."id" FROM "drafts"
|
|
)
|
|
SQL
|
|
end
|
|
|
|
def down
|
|
raise ActiveRecord::IrreversibleMigration
|
|
end
|
|
end
|