]> cat aescling's git repositories - mastodon.git/commitdiff
Fix existing boosts possibly referencing deleted toots (#17730)
authorClaire <claire.github-309c@sitedethib.com>
Wed, 9 Mar 2022 21:44:37 +0000 (22:44 +0100)
committerGitHub <noreply@github.com>
Wed, 9 Mar 2022 21:44:37 +0000 (22:44 +0100)
Follow-up to #17693

db/migrate/20220309213005_fix_reblog_deleted_at.rb [new file with mode: 0644]
db/schema.rb

diff --git a/db/migrate/20220309213005_fix_reblog_deleted_at.rb b/db/migrate/20220309213005_fix_reblog_deleted_at.rb
new file mode 100644 (file)
index 0000000..8ec1813
--- /dev/null
@@ -0,0 +1,9 @@
+class FixReblogDeletedAt < ActiveRecord::Migration[6.1]
+  disable_ddl_transaction!
+
+  def up
+    safety_assured { execute 'UPDATE statuses s SET deleted_at = r.deleted_at FROM statuses r WHERE s.reblog_of_id = r.id AND r.deleted_at IS NOT NULL' }
+  end
+
+  def down; end
+end
index 6251fa28c5fff8129158288bed6069a8544fd9c7..79e9b0f4dd02c5a6aa38526085957958a55045ca 100644 (file)
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 2022_03_07_094650) do
+ActiveRecord::Schema.define(version: 2022_03_09_213005) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"