Files
danbooru/db/seeds.rb
evazion fcec99405c Fix failure in rake db:migrate on fresh install (#3443).
Create the DanbooruBot account in db/seeds.rb instead of in an
initializer. Move the old db/seeds.rb to db/populate.rb.

Fixes a bug introduced in e2eb45a. Creating DanbooruBot in an
initializer was wrong because in a fresh install the users table doesn't
exist yet. This caused `rake db:migrate` to fail.
2017-12-21 12:08:08 -06:00

11 lines
236 B
Ruby

require "securerandom"
system = User.find_or_create_by!(name: Danbooru.config.system_user) do |user|
user.password = SecureRandom.base64(32)
end
unless system.is_moderator?
system.level = User::Levels::MODERATOR
system.save
end