about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authormultiple creatures <dev@multiple-creature.party>2019-07-24 16:40:58 -0500
committermultiple creatures <dev@multiple-creature.party>2019-07-24 16:40:58 -0500
commit1f7a5bb57e3974aa7389935aa296593500d8afb9 (patch)
tree37d987c45396335d818d4d87466a232fac408740 /db
parentcefcad113031ce580121d33c489d33f59e459fc4 (diff)
remove chat tables & adjust status table index
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20190724173350_remove_chat.rb15
-rw-r--r--db/migrate/20190724175247_add_public_index_to_statuses.rb6
2 files changed, 21 insertions, 0 deletions
diff --git a/db/migrate/20190724173350_remove_chat.rb b/db/migrate/20190724173350_remove_chat.rb
new file mode 100644
index 000000000..8425d06dd
--- /dev/null
+++ b/db/migrate/20190724173350_remove_chat.rb
@@ -0,0 +1,15 @@
+class RemoveChat < ActiveRecord::Migration[5.2]
+  def up
+    Status.where(visibility: 6).find_each &:destroy
+    remove_index :statuses, name: "index_statuses_on_account_id_and_id_and_visibility"
+    safety_assured {
+      remove_column :accounts, :supports_chat
+      remove_column :tags, :chat
+      drop_table :chat_accounts
+    }
+  end
+
+  def down
+    raise ActiveRecord::IrreversibleMigration
+  end
+end
diff --git a/db/migrate/20190724175247_add_public_index_to_statuses.rb b/db/migrate/20190724175247_add_public_index_to_statuses.rb
new file mode 100644
index 000000000..1c70260b4
--- /dev/null
+++ b/db/migrate/20190724175247_add_public_index_to_statuses.rb
@@ -0,0 +1,6 @@
+class AddPublicIndexToStatuses < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+  def change
+    add_index :statuses, [:account_id, :id, :visibility], where: 'visibility IN (0, 1, 2, 4)', order: { id: :desc }, algorithm: :concurrently
+  end
+end