about summary refs log tree commit diff
path: root/db
diff options
context:
space:
mode:
authorClaire <claire.github-309c@sitedethib.com>2022-01-23 15:46:30 +0100
committerGitHub <noreply@github.com>2022-01-23 15:46:30 +0100
commit8a07ecd3773b1beae607bfe1edde62104654d64f (patch)
treef1fa7b67f72732944a55b4fe1b3b1c9eca522df9 /db
parent96f0b33c8b994440199bccda14123d0569c6bcc5 (diff)
Remove leftover database columns from Devise::Models::Rememberable (#17191)
* Remove leftover database columns from Devise::Models::Rememberable

* Update fix-duplication maintenance script

* Improve errors/warnings in the fix-duplicates maintenance script
Diffstat (limited to 'db')
-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
3 files changed, 22 insertions, 4 deletions
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 4e0f76dcd..fd4633d69 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"
@@ -937,7 +937,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"
@@ -959,7 +958,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
@@ -972,7 +970,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