Sha256: c6765b81fe194c5db1600b339c5f95253df379773569a66822b17bcadf489162
Contents?: true
Size: 545 Bytes
Versions: 7
Compression:
Stored size: 545 Bytes
Contents
class AddFirstAdminUser < ActiveRecord::Migration[6.0] def up email = "admin@example.com" User.reset_column_information u=User.find_or_initialize_by(email: email) psswd = SecureRandom.hex(5) u.password = psswd u.password_confirmation = psswd u.admin = true u.save! puts "\nPlease find generated initial admin password in .passwords file." File.open('.passwords', 'w') do |f| f.write(psswd) end end def down email = "admin@example.com" User.find_by(email: email).destroy end end
Version data entries
7 entries across 7 versions & 1 rubygems