diff --git a/db/migrate/20101026184949_create_users.rb b/db/migrate/20101026184949_create_users.rb deleted file mode 100644 index e0622974..00000000 --- a/db/migrate/20101026184949_create_users.rb +++ /dev/null @@ -1,31 +0,0 @@ -# frozen_string_literal: true - -class CreateUsers < ActiveRecord::Migration[4.2] - def up - unless table_exists?("spree_users") - create_table "spree_users", force: true do |t| - t.string "crypted_password", limit: 128 - t.string "salt", limit: 128 - t.string "email" - t.string "remember_token" - t.string "remember_token_expires_at" - t.string "persistence_token" - t.string "single_access_token" - t.string "perishable_token" - t.integer "login_count", default: 0, null: false - t.integer "failed_login_count", default: 0, null: false - t.datetime "last_request_at" - t.datetime "current_login_at" - t.datetime "last_login_at" - t.string "current_login_ip" - t.string "last_login_ip" - t.string "login" - t.integer "ship_address_id" - t.integer "bill_address_id" - t.datetime "created_at", null: false - t.datetime "updated_at", null: false - t.string "openid_identifier" - end - end - end -end diff --git a/db/migrate/20101026184950_rename_columns_for_devise.rb b/db/migrate/20101026184950_rename_columns_for_devise.rb deleted file mode 100644 index a7c74e84..00000000 --- a/db/migrate/20101026184950_rename_columns_for_devise.rb +++ /dev/null @@ -1,37 +0,0 @@ -# frozen_string_literal: true - -class RenameColumnsForDevise < ActiveRecord::Migration[4.2] - def up - return if column_exists?(:spree_users, :password_salt) - - rename_column :spree_users, :crypted_password, :encrypted_password - rename_column :spree_users, :salt, :password_salt - rename_column :spree_users, :remember_token_expires_at, :remember_created_at - rename_column :spree_users, :login_count, :sign_in_count - rename_column :spree_users, :failed_login_count, :failed_attempts - rename_column :spree_users, :single_access_token, :reset_password_token - rename_column :spree_users, :current_login_at, :current_sign_in_at - rename_column :spree_users, :last_login_at, :last_sign_in_at - rename_column :spree_users, :current_login_ip, :current_sign_in_ip - rename_column :spree_users, :last_login_ip, :last_sign_in_ip - add_column :spree_users, :unlock_token, :string - add_column :spree_users, :locked_at, :datetime - remove_column :spree_users, :openid_identifier - end - - def down - remove_column :spree_users, :locked_at - remove_column :spree_users, :unlock_token - rename_column :spree_users, :last_sign_in_ip, :last_login_ip - rename_column :spree_users, :current_sign_in_ip, :current_login_ip - rename_column :spree_users, :last_sign_in_at, :last_login_at - rename_column :spree_users, :current_sign_in_at, :current_login_at - rename_column :spree_users, :reset_password_token, :single_access_token - rename_column :spree_users, :failed_attempts, :failed_login_count - rename_column :spree_users, :sign_in_count, :login_count - rename_column :spree_users, :remember_created_at, :remember_token_expires_at - rename_column :spree_users, :password_salt, :salt - rename_column :spree_users, :encrypted_password, :crypted_password - add_column :spree_users, :openid_identifier, :string - end -end diff --git a/db/migrate/20101214150824_convert_user_remember_field.rb b/db/migrate/20101214150824_convert_user_remember_field.rb deleted file mode 100644 index 25fb2502..00000000 --- a/db/migrate/20101214150824_convert_user_remember_field.rb +++ /dev/null @@ -1,13 +0,0 @@ -# frozen_string_literal: true - -class ConvertUserRememberField < ActiveRecord::Migration[4.2] - def up - remove_column :spree_users, :remember_created_at - add_column :spree_users, :remember_created_at, :datetime - end - - def down - remove_column :spree_users, :remember_created_at - add_column :spree_users, :remember_created_at, :string - end -end diff --git a/db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb b/db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb deleted file mode 100644 index 988e483a..00000000 --- a/db/migrate/20120203010234_add_reset_password_sent_at_to_spree_users.rb +++ /dev/null @@ -1,10 +0,0 @@ -# frozen_string_literal: true - -class AddResetPasswordSentAtToSpreeUsers < ActiveRecord::Migration[4.2] - def change - Spree::User.reset_column_information - unless Spree::User.column_names.include?("reset_password_sent_at") - add_column :spree_users, :reset_password_sent_at, :datetime - end - end -end diff --git a/db/migrate/20120605211305_make_users_email_index_unique.rb b/db/migrate/20120605211305_make_users_email_index_unique.rb deleted file mode 100644 index f521eed0..00000000 --- a/db/migrate/20120605211305_make_users_email_index_unique.rb +++ /dev/null @@ -1,11 +0,0 @@ -# frozen_string_literal: true - -class MakeUsersEmailIndexUnique < ActiveRecord::Migration[4.2] - def up - add_index "spree_users", ["email"], name: "email_idx_unique", unique: true - end - - def down - remove_index "spree_users", name: "email_idx_unique" - end -end diff --git a/db/migrate/20140904000425_add_deleted_at_to_users.rb b/db/migrate/20140904000425_add_deleted_at_to_users.rb deleted file mode 100644 index b98ec13b..00000000 --- a/db/migrate/20140904000425_add_deleted_at_to_users.rb +++ /dev/null @@ -1,8 +0,0 @@ -# frozen_string_literal: true - -class AddDeletedAtToUsers < ActiveRecord::Migration[4.2] - def change - add_column :spree_users, :deleted_at, :datetime - add_index :spree_users, :deleted_at - end -end diff --git a/db/migrate/20141002154641_add_confirmable_to_users.rb b/db/migrate/20141002154641_add_confirmable_to_users.rb deleted file mode 100644 index c319f5ca..00000000 --- a/db/migrate/20141002154641_add_confirmable_to_users.rb +++ /dev/null @@ -1,9 +0,0 @@ -# frozen_string_literal: true - -class AddConfirmableToUsers < ActiveRecord::Migration[4.2] - def change - add_column :spree_users, :confirmation_token, :string - add_column :spree_users, :confirmed_at, :datetime - add_column :spree_users, :confirmation_sent_at, :datetime - end -end diff --git a/db/migrate/20190125170630_add_reset_password_token_index_to_spree_users.rb b/db/migrate/20190125170630_add_reset_password_token_index_to_spree_users.rb deleted file mode 100644 index ced11714..00000000 --- a/db/migrate/20190125170630_add_reset_password_token_index_to_spree_users.rb +++ /dev/null @@ -1,34 +0,0 @@ -# frozen_string_literal: true - -class AddResetPasswordTokenIndexToSpreeUsers < ActiveRecord::Migration[4.2] - # We're not using the standard Rails index name because somebody could have - #  already added that index to the table. By using a custom name we ensure - # that the index can effectively be added and removed via migrations/rollbacks - #  without having any impact on such installations. The index name is Rails - # standard name + "_solidus_auth_devise"; the length is 61 chars which is - # still OK for Sqlite, mySQL and Postgres. - def custom_index_name - "index_spree_users_on_reset_password_token_solidus_auth_devise" - end - - def default_index_exists? - index_exists?(:spree_users, :reset_password_token) - end - - def custom_index_exists? - index_exists?(:spree_users, :reset_password_token, name: custom_index_name) - end - - def up - Spree::User.reset_column_information - if Spree::User.column_names.include?("reset_password_token") && !default_index_exists? && !custom_index_exists? - add_index :spree_users, :reset_password_token, unique: true, name: custom_index_name - end - end - - def down - if custom_index_exists? - remove_index :spree_users, name: custom_index_name - end - end -end diff --git a/db/migrate/20200417153503_add_unconfirmed_email_to_spree_users.rb b/db/migrate/20200417153503_add_unconfirmed_email_to_spree_users.rb deleted file mode 100644 index 083fe8d5..00000000 --- a/db/migrate/20200417153503_add_unconfirmed_email_to_spree_users.rb +++ /dev/null @@ -1,7 +0,0 @@ -class AddUnconfirmedEmailToSpreeUsers < ActiveRecord::Migration[5.1] - def change - unless column_exists?(:spree_users, :unconfirmed_email) - add_column :spree_users, :unconfirmed_email, :string - end - end -end diff --git a/db/migrate/20260103231422_create_spree_users.rb b/db/migrate/20260103231422_create_spree_users.rb new file mode 100644 index 00000000..0810d43a --- /dev/null +++ b/db/migrate/20260103231422_create_spree_users.rb @@ -0,0 +1,60 @@ +# frozen_string_literal: true + +class CreateSpreeUsers < ActiveRecord::Migration[7.0] + def change + create_table :spree_users, if_not_exists: true do |t| + t.string :login + t.string :email + t.string :unconfirmed_email + + t.string :encrypted_password, limit: 128 + t.string :password_salt, limit: 128 + t.string :reset_password_token + t.string :spree_api_key, limit: 48 + + t.string :confirmation_token + t.string :perishable_token + t.string :persistence_token + t.string :remember_token + t.string :unlock_token + + t.integer :sign_in_count, default: 0, null: false + t.integer :failed_attempts, default: 0, null: false + + t.string :current_sign_in_ip + t.string :last_sign_in_ip + + t.references :ship_address, foreign_key: {to_table: :spree_addresses} + t.references :bill_address, foreign_key: {to_table: :spree_addresses} + + t.datetime :confirmation_sent_at + t.datetime :confirmed_at + t.datetime :current_sign_in_at + t.datetime :deleted_at + t.datetime :last_request_at + t.datetime :last_sign_in_at + t.datetime :locked_at + t.datetime :remember_created_at + t.datetime :reset_password_sent_at + + t.timestamps null: false + end + + if column_exists?(:spree_users, :deleted_at) + add_index :spree_users, :deleted_at, if_not_exists: true + end + + if column_exists?(:spree_users, :email) + add_index :spree_users, :email, + name: "email_idx_unique", + if_not_exists: true, + unique: true + end + + if column_exists?(:spree_users, :reset_password_token) + add_index :spree_users, :reset_password_token, + if_not_exists: true, + unique: true + end + end +end