about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-03-10 17:29:15 +0100
committerGitHub <noreply@github.com>2022-03-10 17:29:15 +0100
commit2c8bb1745359a3bf200d37383dc56d5951e2b6bc (patch)
tree6b22f1ab7e96c9223760de2a74dc1d4d985f7758 /db
parent02133866e6915e37431298b396e1aded1e4c44c5 (diff)
parent43bce02a7ae78954be8857f547434c56ac59fa59 (diff)
Merge pull request #1715 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
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/migrate/20220307094650_fix_featured_tags_constraints.rb17
-rw-r--r--db/migrate/20220309213005_fix_reblog_deleted_at.rb9
-rw-r--r--db/post_migrate/20220303203437_remove_media_attachments_changed_from_status_edits.rb7
-rw-r--r--db/schema.rb13
6 files changed, 54 insertions, 5 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/migrate/20220307094650_fix_featured_tags_constraints.rb b/db/migrate/20220307094650_fix_featured_tags_constraints.rb
new file mode 100644
index 000000000..bad1c90d4
--- /dev/null
+++ b/db/migrate/20220307094650_fix_featured_tags_constraints.rb
@@ -0,0 +1,17 @@
+class FixFeaturedTagsConstraints < ActiveRecord::Migration[6.1]
+  def up
+    safety_assured do
+      execute 'DELETE FROM featured_tags WHERE tag_id IS NULL'
+      change_column_null :featured_tags, :tag_id, false
+      execute 'DELETE FROM featured_tags WHERE account_id IS NULL'
+      change_column_null :featured_tags, :account_id, false
+    end
+  end
+
+  def down
+    safety_assured do
+      change_column_null :featured_tags, :tag_id, true
+      change_column_null :featured_tags, :account_id, true
+    end
+  end
+end
diff --git a/db/migrate/20220309213005_fix_reblog_deleted_at.rb b/db/migrate/20220309213005_fix_reblog_deleted_at.rb
new file mode 100644
index 000000000..8ec1813d9
--- /dev/null
+++ b/db/migrate/20220309213005_fix_reblog_deleted_at.rb
@@ -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
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 f8d85901d..3f51b85d5 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
 #
 # It's strongly recommended that you check this file into your version control system.
 
-ActiveRecord::Schema.define(version: 2022_03_04_195405) 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"
@@ -391,7 +391,6 @@ ActiveRecord::Schema.define(version: 2022_03_04_195405) 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
 
@@ -420,8 +419,8 @@ ActiveRecord::Schema.define(version: 2022_03_04_195405) do
   end
 
   create_table "featured_tags", force: :cascade do |t|
-    t.bigint "account_id"
-    t.bigint "tag_id"
+    t.bigint "account_id", null: false
+    t.bigint "tag_id", null: false
     t.bigint "statuses_count", default: 0, null: false
     t.datetime "last_status_at"
     t.datetime "created_at", null: false
@@ -845,10 +844,13 @@ ActiveRecord::Schema.define(version: 2022_03_04_195405) 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.string "content_type"
+    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
@@ -895,6 +897,7 @@ ActiveRecord::Schema.define(version: 2022_03_04_195405) 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)))"