mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-02 04:35:26 +00:00
Upgraded to rails 8.0.2, moved from dalli to solid cache, moved from delayed_job to solid queue, and add solid cable. deploy/rails-dev-run.sh no longer needs to chmod. Fixed finished_at callback for matches. Migrated from Devise to built in rails auth. Added view tests for the bracket page testing that all bout numbers render for all matches in each bracket type.
This commit is contained in:
35
lib/tasks/auth_migration.rake
Normal file
35
lib/tasks/auth_migration.rake
Normal file
@@ -0,0 +1,35 @@
|
||||
namespace :auth do
|
||||
desc "Migrate from Devise to Rails Authentication"
|
||||
task migrate: :environment do
|
||||
puts "Running Authentication Migration"
|
||||
puts "================================"
|
||||
|
||||
# Run the migrations
|
||||
Rake::Task["db:migrate"].invoke
|
||||
|
||||
# Ensure all existing users have a password_digest value
|
||||
users_without_digest = User.where(password_digest: nil)
|
||||
|
||||
if users_without_digest.any?
|
||||
puts "Setting password_digest for #{users_without_digest.count} users..."
|
||||
|
||||
ActiveRecord::Base.transaction do
|
||||
users_without_digest.each do |user|
|
||||
if user.encrypted_password.present?
|
||||
# Copy Devise's encrypted_password to password_digest
|
||||
# This works because both use bcrypt in the same format
|
||||
user.update_column(:password_digest, user.encrypted_password)
|
||||
print "."
|
||||
else
|
||||
puts "\nWARNING: User #{user.id} (#{user.email}) has no encrypted_password!"
|
||||
end
|
||||
end
|
||||
end
|
||||
puts "\nDone!"
|
||||
else
|
||||
puts "All users already have a password_digest."
|
||||
end
|
||||
|
||||
puts "Migration complete."
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user