about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorFire Demon <firedemon@creature.cafe>2020-09-21 02:22:56 -0500
committerFire Demon <firedemon@creature.cafe>2020-09-21 14:52:42 -0500
commit39b07aad85c0abd897f37860f5c9da854dcf523d (patch)
tree42e31cdcf95baa357ca1d5e91476421a9803f4ab /db
parent97d578eebdcbbc4705a303e8923e0332651890c1 (diff)
Drop Monsterfork v2 thread permissions; simplify feed filters
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20200721212401_backfill_account_id_on_conversations.rb15
-rw-r--r--db/migrate/20200726095058_backfill_semiprivate_on_statuses.rb14
-rw-r--r--db/migrate/20200923000001_remove_conversation_account.rb7
-rw-r--r--db/migrate/20200923000002_remove_semiprivate_flag.rb7
-rw-r--r--db/schema.rb6
5 files changed, 15 insertions, 34 deletions
diff --git a/db/migrate/20200721212401_backfill_account_id_on_conversations.rb b/db/migrate/20200721212401_backfill_account_id_on_conversations.rb
deleted file mode 100644
index 595fd8e52..000000000
--- a/db/migrate/20200721212401_backfill_account_id_on_conversations.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-class BackfillAccountIdOnConversations < ActiveRecord::Migration[5.2]
-  disable_ddl_transaction!
-
-  def up
-    Rails.logger.info('Backfilling owners of conversation threads...')
-    safety_assured do
-      Conversation.left_outer_joins(:statuses).where(statuses: { id: nil }).in_batches.destroy_all
-      execute('UPDATE conversations SET account_id = s.account_id FROM (SELECT account_id, conversation_id FROM statuses WHERE NOT reply) AS s WHERE conversations.id = s.conversation_id')
-    end
-  end
-
-  def down
-    true
-  end
-end
diff --git a/db/migrate/20200726095058_backfill_semiprivate_on_statuses.rb b/db/migrate/20200726095058_backfill_semiprivate_on_statuses.rb
deleted file mode 100644
index 0f247146e..000000000
--- a/db/migrate/20200726095058_backfill_semiprivate_on_statuses.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-class BackfillSemiprivateOnStatuses < ActiveRecord::Migration[5.2]
-  disable_ddl_transaction!
-
-  def up
-    Rails.logger.info('Backfilling semiprivate statuses...')
-    safety_assured do
-      Status.where(id: StatusDomainPermission.select(:status_id)).in_batches.update_all(semiprivate: true)
-    end
-  end
-
-  def down
-    true
-  end
-end
diff --git a/db/migrate/20200923000001_remove_conversation_account.rb b/db/migrate/20200923000001_remove_conversation_account.rb
new file mode 100644
index 000000000..1b61d41bf
--- /dev/null
+++ b/db/migrate/20200923000001_remove_conversation_account.rb
@@ -0,0 +1,7 @@
+class RemoveConversationAccount < ActiveRecord::Migration[5.2]
+  def change
+    safety_assured do
+      remove_column :conversations, :account_id
+    end
+  end
+end
diff --git a/db/migrate/20200923000002_remove_semiprivate_flag.rb b/db/migrate/20200923000002_remove_semiprivate_flag.rb
new file mode 100644
index 000000000..cd732c616
--- /dev/null
+++ b/db/migrate/20200923000002_remove_semiprivate_flag.rb
@@ -0,0 +1,7 @@
+class RemoveSemiprivateFlag < ActiveRecord::Migration[5.2]
+  def change
+    safety_assured do
+      remove_column :statuses, :semiprivate
+    end
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 97e4b3142..4e3114068 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: 2020_09_23_000000) do
+ActiveRecord::Schema.define(version: 2020_09_23_000002) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -328,10 +328,8 @@ ActiveRecord::Schema.define(version: 2020_09_23_000000) do
     t.string "uri"
     t.datetime "created_at", null: false
     t.datetime "updated_at", null: false
-    t.bigint "account_id"
     t.boolean "public", default: false, null: false
     t.string "root"
-    t.index ["account_id"], name: "index_conversations_on_account_id"
     t.index ["uri"], name: "index_conversations_on_uri", unique: true
   end
 
@@ -877,7 +875,6 @@ ActiveRecord::Schema.define(version: 2020_09_23_000000) do
     t.integer "nest_level", limit: 2, default: 0, null: false
     t.boolean "published", default: true, null: false
     t.text "title"
-    t.boolean "semiprivate", default: false, null: false
     t.text "original_text"
     t.text "footer"
     t.datetime "expires_at"
@@ -1071,7 +1068,6 @@ ActiveRecord::Schema.define(version: 2020_09_23_000000) do
   add_foreign_key "collection_pages", "accounts", on_delete: :cascade
   add_foreign_key "conversation_mutes", "accounts", name: "fk_225b4212bb", on_delete: :cascade
   add_foreign_key "conversation_mutes", "conversations", on_delete: :cascade
-  add_foreign_key "conversations", "accounts"
   add_foreign_key "custom_emojis", "accounts", on_delete: :nullify
   add_foreign_key "custom_filters", "accounts", on_delete: :cascade
   add_foreign_key "devices", "accounts", on_delete: :cascade