about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorEugen Rochko <eugen@zeonfederated.com>2022-03-09 09:06:17 +0100
committerGitHub <noreply@github.com>2022-03-09 09:06:17 +0100
commitd17fb7013116767fc5c7d5eef63218bd8c45b023 (patch)
tree38714f6b03b57940aec4ba35d3de2b7f6859999c /db
parentbd53dd521064b12261b82105624cf5f8b9ca9d69 (diff)
Change how changes to media attachments are stored for edits (#17696)
* Change how changes to media attachments are stored for edits

Fix not being able to re-order media attachments

* Fix not broadcasting updates when polls/media is changed through ActivityPub

* Various fixes and improvements

* Update app/models/report.rb

Co-authored-by: Claire <claire.github-309c@sitedethib.com>

* Add tracking of media attachment description changes

* Change poll in status edit to have a structure closer to the real one

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20220302232632_add_ordered_media_attachment_ids_to_statuses.rb5
-rw-r--r--db/migrate/20220303000827_add_ordered_media_attachment_ids_to_status_edits.rb8
-rw-r--r--db/post_migrate/20220303203437_remove_media_attachments_changed_from_status_edits.rb7
-rw-r--r--db/schema.rb7
4 files changed, 25 insertions, 2 deletions
diff --git a/db/migrate/20220302232632_add_ordered_media_attachment_ids_to_statuses.rb b/db/migrate/20220302232632_add_ordered_media_attachment_ids_to_statuses.rb
new file mode 100644
index 000000000..5443f32a2
--- /dev/null
+++ b/db/migrate/20220302232632_add_ordered_media_attachment_ids_to_statuses.rb
@@ -0,0 +1,5 @@
+class AddOrderedMediaAttachmentIdsToStatuses < ActiveRecord::Migration[6.1]
+  def change
+    add_column :statuses, :ordered_media_attachment_ids, :bigint, array: true
+  end
+end
diff --git a/db/migrate/20220303000827_add_ordered_media_attachment_ids_to_status_edits.rb b/db/migrate/20220303000827_add_ordered_media_attachment_ids_to_status_edits.rb
new file mode 100644
index 000000000..b1071f359
--- /dev/null
+++ b/db/migrate/20220303000827_add_ordered_media_attachment_ids_to_status_edits.rb
@@ -0,0 +1,8 @@
+class AddOrderedMediaAttachmentIdsToStatusEdits < ActiveRecord::Migration[6.1]
+  def change
+    add_column :status_edits, :ordered_media_attachment_ids, :bigint, array: true
+    add_column :status_edits, :media_descriptions, :text, array: true
+    add_column :status_edits, :poll_options, :string, array: true
+    add_column :status_edits, :sensitive, :boolean
+  end
+end
diff --git a/db/post_migrate/20220303203437_remove_media_attachments_changed_from_status_edits.rb b/db/post_migrate/20220303203437_remove_media_attachments_changed_from_status_edits.rb
new file mode 100644
index 000000000..09725c74e
--- /dev/null
+++ b/db/post_migrate/20220303203437_remove_media_attachments_changed_from_status_edits.rb
@@ -0,0 +1,7 @@
+# frozen_string_literal: true
+
+class RemoveMediaAttachmentsChangedFromStatusEdits < ActiveRecord::Migration[5.2]
+  def change
+    safety_assured { remove_column :status_edits, :media_attachments_changed, :boolean, default: false, null: false }
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index ef1620113..6251fa28c 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -391,7 +391,6 @@ ActiveRecord::Schema.define(version: 2022_03_07_094650) do
     t.bigint "parent_id"
     t.inet "ips", array: true
     t.datetime "last_refresh_at"
-
     t.index ["domain"], name: "index_email_domain_blocks_on_domain", unique: true
   end
 
@@ -845,9 +844,12 @@ ActiveRecord::Schema.define(version: 2022_03_07_094650) do
     t.bigint "account_id"
     t.text "text", default: "", null: false
     t.text "spoiler_text", default: "", null: false
-    t.boolean "media_attachments_changed", default: false, null: false
     t.datetime "created_at", precision: 6, null: false
     t.datetime "updated_at", precision: 6, null: false
+    t.bigint "ordered_media_attachment_ids", array: true
+    t.text "media_descriptions", array: true
+    t.string "poll_options", array: true
+    t.boolean "sensitive"
     t.index ["account_id"], name: "index_status_edits_on_account_id"
     t.index ["status_id"], name: "index_status_edits_on_status_id"
   end
@@ -892,6 +894,7 @@ ActiveRecord::Schema.define(version: 2022_03_07_094650) do
     t.datetime "deleted_at"
     t.datetime "edited_at"
     t.boolean "trendable"
+    t.bigint "ordered_media_attachment_ids", array: true
     t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20190820", order: { id: :desc }, where: "(deleted_at IS NULL)"
     t.index ["deleted_at"], name: "index_statuses_on_deleted_at", where: "(deleted_at IS NOT NULL)"
     t.index ["id", "account_id"], name: "index_statuses_local_20190824", order: { id: :desc }, where: "((local OR (uri IS NULL)) AND (deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))"