about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-01-23 18:13:55 +0100
committerClaire <claire.github-309c@sitedethib.com>2022-01-23 18:24:01 +0100
commit61ef81c548a0140a80281d4004ac55873d8f74d6 (patch)
tree770c251059d139243b9cb557c762648e0af55037 /db
parent4d0383d75ac606f8c9c2b8ecb0ea2dddf28213cb (diff)
parent0a120d86d28e3f2e20455f56c1656f5d5f2f4af6 (diff)
Merge branch 'main' into glitch-soc/merge-upstream
Conflicts:
- `spec/models/status_spec.rb`:
  Upstream added tests too close to glitch-soc-specific tests.
  Kept both tests.
Diffstat (limited to 'db')
-rw-r--r--db/migrate/20220105163928_remove_mentions_status_id_index.rb9
-rw-r--r--db/post_migrate/20220118183010_remove_index_users_on_remember_token.rb13
-rw-r--r--db/post_migrate/20220118183123_remove_rememberable_from_users.rb8
-rw-r--r--db/schema.rb5
4 files changed, 31 insertions, 4 deletions
diff --git a/db/migrate/20220105163928_remove_mentions_status_id_index.rb b/db/migrate/20220105163928_remove_mentions_status_id_index.rb
new file mode 100644
index 000000000..56e903719
--- /dev/null
+++ b/db/migrate/20220105163928_remove_mentions_status_id_index.rb
@@ -0,0 +1,9 @@
+class RemoveMentionsStatusIdIndex < ActiveRecord::Migration[6.1]
+  def up
+    remove_index :mentions, name: :mentions_status_id_index if index_exists?(:mentions, :status_id, name: :mentions_status_id_index)
+  end
+
+  def down
+    # As this index should not exist and is a duplicate of another index, do not re-create it
+  end
+end
diff --git a/db/post_migrate/20220118183010_remove_index_users_on_remember_token.rb b/db/post_migrate/20220118183010_remove_index_users_on_remember_token.rb
new file mode 100644
index 000000000..367d489de
--- /dev/null
+++ b/db/post_migrate/20220118183010_remove_index_users_on_remember_token.rb
@@ -0,0 +1,13 @@
+# frozen_string_literal: true
+
+class RemoveIndexUsersOnRememberToken < ActiveRecord::Migration[6.1]
+  disable_ddl_transaction!
+
+  def up
+    remove_index :users, name: :index_users_on_remember_token
+  end
+
+  def down
+    add_index :users, :remember_token, algorithm: :concurrently, unique: true, name: :index_users_on_remember_token
+  end
+end
diff --git a/db/post_migrate/20220118183123_remove_rememberable_from_users.rb b/db/post_migrate/20220118183123_remove_rememberable_from_users.rb
new file mode 100644
index 000000000..1e274c6e0
--- /dev/null
+++ b/db/post_migrate/20220118183123_remove_rememberable_from_users.rb
@@ -0,0 +1,8 @@
+class RemoveRememberableFromUsers < ActiveRecord::Migration[6.1]
+  def change
+    safety_assured do
+      remove_column :users, :remember_token, :string, null: true, default: nil
+      remove_column :users, :remember_created_at, :datetime, null: true, default: nil
+    end
+  end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 1c07a1a49..ff28f7a7f 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_01_16_202951) do
+ActiveRecord::Schema.define(version: 2022_01_18_183123) do
 
   # These are extensions that must be enabled in order to support this database
   enable_extension "plpgsql"
@@ -939,7 +939,6 @@ ActiveRecord::Schema.define(version: 2022_01_16_202951) do
     t.string "encrypted_password", default: "", null: false
     t.string "reset_password_token"
     t.datetime "reset_password_sent_at"
-    t.datetime "remember_created_at"
     t.integer "sign_in_count", default: 0, null: false
     t.datetime "current_sign_in_at"
     t.datetime "last_sign_in_at"
@@ -961,7 +960,6 @@ ActiveRecord::Schema.define(version: 2022_01_16_202951) do
     t.boolean "disabled", default: false, null: false
     t.boolean "moderator", default: false, null: false
     t.bigint "invite_id"
-    t.string "remember_token"
     t.string "chosen_languages", array: true
     t.bigint "created_by_application_id"
     t.boolean "approved", default: true, null: false
@@ -974,7 +972,6 @@ ActiveRecord::Schema.define(version: 2022_01_16_202951) do
     t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
     t.index ["created_by_application_id"], name: "index_users_on_created_by_application_id"
     t.index ["email"], name: "index_users_on_email", unique: true
-    t.index ["remember_token"], name: "index_users_on_remember_token", unique: true
     t.index ["reset_password_token"], name: "index_users_on_reset_password_token", unique: true
   end