Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add migration version to migrations #82

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion db/migrate/20101026184949_create_users.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class CreateUsers < ActiveRecord::Migration
class CreateUsers < Spree::Auth.rails_4_2_compatible_migration_class
def up
unless table_exists?("spree_users")
create_table "spree_users", :force => true do |t|
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20101026184950_rename_columns_for_devise.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class RenameColumnsForDevise < ActiveRecord::Migration
class RenameColumnsForDevise < Spree::Auth.rails_4_2_compatible_migration_class
def up
return if column_exists?(:spree_users, :password_salt)
rename_column :spree_users, :crypted_password, :encrypted_password
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20101214150824_convert_user_remember_field.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class ConvertUserRememberField < ActiveRecord::Migration
class ConvertUserRememberField < Spree::Auth.rails_4_2_compatible_migration_class
def up
remove_column :spree_users, :remember_created_at
add_column :spree_users, :remember_created_at, :datetime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class AddResetPasswordSentAtToSpreeUsers < ActiveRecord::Migration
class AddResetPasswordSentAtToSpreeUsers < Spree::Auth.rails_4_2_compatible_migration_class
def change
Spree::User.reset_column_information
unless Spree::User.column_names.include?("reset_password_sent_at")
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20120605211305_make_users_email_index_unique.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class MakeUsersEmailIndexUnique < ActiveRecord::Migration
class MakeUsersEmailIndexUnique < Spree::Auth.rails_4_2_compatible_migration_class
def up
add_index "spree_users", ["email"], :name => "email_idx_unique", :unique => true
end
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20140904000425_add_deleted_at_to_users.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class AddDeletedAtToUsers < ActiveRecord::Migration
class AddDeletedAtToUsers < Spree::Auth.rails_4_2_compatible_migration_class
def change
add_column :spree_users, :deleted_at, :datetime
add_index :spree_users, :deleted_at
Expand Down
2 changes: 1 addition & 1 deletion db/migrate/20141002154641_add_confirmable_to_users.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class AddConfirmableToUsers < ActiveRecord::Migration
class AddConfirmableToUsers < Spree::Auth.rails_4_2_compatible_migration_class
def change
add_column :spree_users, :confirmation_token, :string
add_column :spree_users, :confirmed_at, :datetime
Expand Down
8 changes: 8 additions & 0 deletions lib/spree/auth/devise.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ module Auth
def self.config(&block)
yield(Spree::Auth::Config)
end

def self.rails_4_2_compatible_migration_class
if Rails.gem_version >= Gem::Version.new('5')
ActiveRecord::Migration[4.2]
else
ActiveRecord::Migration
end
end
end
end

Expand Down