about summary refs log tree commit diff
path: root/db/migrate
diff options
context:
space:
mode:
authorSpencer Alves <impiaaa@gmail.com>2018-05-31 21:33:16 -0700
committerSpencer Alves <impiaaa@gmail.com>2018-05-31 21:33:16 -0700
commit7d2e6429c27c5ddc8ef3d2366c44329092e07f77 (patch)
tree7cfd2035f69616a369b2f3762ce9cefe61c2bd22 /db/migrate
parentf2ff167c1a8df9b2521d33fcca15b8d5c67c50b1 (diff)
parente396fbfe3bf4d2a404e78e73cff1a609dd0a9bfb (diff)
Merge branch 'glitch' into thread-icon
Diffstat (limited to 'db/migrate')
-rw-r--r--db/migrate/20180416210259_add_uri_to_relationships.rb7
-rw-r--r--db/migrate/20180506221944_add_actor_type_to_accounts.rb5
-rw-r--r--db/migrate/20180510214435_add_access_token_id_to_web_push_subscriptions.rb6
-rw-r--r--db/migrate/20180510230049_migrate_web_push_subscriptions.rb13
-rw-r--r--db/migrate/20180514130000_improve_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb11
-rw-r--r--db/migrate/20180514140000_revert_index_change_on_statuses_for_api_v1_accounts_account_id_statuses.rb14
6 files changed, 56 insertions, 0 deletions
diff --git a/db/migrate/20180416210259_add_uri_to_relationships.rb b/db/migrate/20180416210259_add_uri_to_relationships.rb
new file mode 100644
index 000000000..d8eaca450
--- /dev/null
+++ b/db/migrate/20180416210259_add_uri_to_relationships.rb
@@ -0,0 +1,7 @@
+class AddUriToRelationships < ActiveRecord::Migration[5.2]
+  def change
+    add_column :follows, :uri, :string
+    add_column :follow_requests, :uri, :string
+    add_column :blocks, :uri, :string
+  end
+end
diff --git a/db/migrate/20180506221944_add_actor_type_to_accounts.rb b/db/migrate/20180506221944_add_actor_type_to_accounts.rb
new file mode 100644
index 000000000..7cfed640f
--- /dev/null
+++ b/db/migrate/20180506221944_add_actor_type_to_accounts.rb
@@ -0,0 +1,5 @@
+class AddActorTypeToAccounts < ActiveRecord::Migration[5.2]
+  def change
+    add_column :accounts, :actor_type, :string
+  end
+end
diff --git a/db/migrate/20180510214435_add_access_token_id_to_web_push_subscriptions.rb b/db/migrate/20180510214435_add_access_token_id_to_web_push_subscriptions.rb
new file mode 100644
index 000000000..94ef8e0f5
--- /dev/null
+++ b/db/migrate/20180510214435_add_access_token_id_to_web_push_subscriptions.rb
@@ -0,0 +1,6 @@
+class AddAccessTokenIdToWebPushSubscriptions < ActiveRecord::Migration[5.2]
+  def change
+    add_reference :web_push_subscriptions, :access_token, null: true, default: nil, foreign_key: { on_delete: :cascade, to_table: :oauth_access_tokens }, index: false
+    add_reference :web_push_subscriptions, :user, null: true, default: nil, foreign_key: { on_delete: :cascade }, index: false
+  end
+end
diff --git a/db/migrate/20180510230049_migrate_web_push_subscriptions.rb b/db/migrate/20180510230049_migrate_web_push_subscriptions.rb
new file mode 100644
index 000000000..6de1bed79
--- /dev/null
+++ b/db/migrate/20180510230049_migrate_web_push_subscriptions.rb
@@ -0,0 +1,13 @@
+class MigrateWebPushSubscriptions < ActiveRecord::Migration[5.2]
+  disable_ddl_transaction!
+
+  def up
+    add_index :web_push_subscriptions, :user_id, algorithm: :concurrently
+    add_index :web_push_subscriptions, :access_token_id, algorithm: :concurrently
+  end
+
+  def down
+    remove_index :web_push_subscriptions, :user_id
+    remove_index :web_push_subscriptions, :access_token_id
+  end
+end
diff --git a/db/migrate/20180514130000_improve_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb b/db/migrate/20180514130000_improve_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb
new file mode 100644
index 000000000..2573bdf94
--- /dev/null
+++ b/db/migrate/20180514130000_improve_index_on_statuses_for_api_v1_accounts_account_id_statuses.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class ImproveIndexOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecord::Migration[5.1]
+  disable_ddl_transaction!
+
+  def change
+    add_index :statuses, [:account_id, :id, :visibility], where: 'visibility IN (0, 1, 2)', algorithm: :concurrently
+    add_index :statuses, [:account_id, :id], where: 'visibility = 3', algorithm: :concurrently
+    remove_index :statuses, column: [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106
+  end
+end
diff --git a/db/migrate/20180514140000_revert_index_change_on_statuses_for_api_v1_accounts_account_id_statuses.rb b/db/migrate/20180514140000_revert_index_change_on_statuses_for_api_v1_accounts_account_id_statuses.rb
new file mode 100644
index 000000000..b6b9f96ae
--- /dev/null
+++ b/db/migrate/20180514140000_revert_index_change_on_statuses_for_api_v1_accounts_account_id_statuses.rb
@@ -0,0 +1,14 @@
+# frozen_string_literal: true
+
+class RevertIndexChangeOnStatusesForApiV1AccountsAccountIdStatuses < ActiveRecord::Migration[5.1]
+  disable_ddl_transaction!
+
+  def change
+    safety_assured do
+      add_index :statuses, [:account_id, :id, :visibility, :updated_at], order: { id: :desc }, algorithm: :concurrently, name: :index_statuses_20180106
+    end
+
+    remove_index :statuses, column: [:account_id, :id, :visibility], where: 'visibility IN (0, 1, 2)', algorithm: :concurrently
+    remove_index :statuses, column: [:account_id, :id], where: 'visibility = 3', algorithm: :concurrently
+  end
+end