about summary refs log tree commit diff
diff options
context:
space:
mode:
authorysksn <bluewhale1982@gmail.com>2019-07-21 10:40:08 +0900
committerEugen Rochko <eugen@zeonfederated.com>2019-07-21 03:40:08 +0200
commit2859790890cc53101d55e132ac05c9f59db2bad5 (patch)
tree2d7895a024d06d2959dae0689a213a5a82ecf6a5
parentc37c1da41e1c490771a409ad1b12f3db55af4cee (diff)
Not to create an account if already exist (#11366)
-rw-r--r--db/seeds.rb3
1 files changed, 2 insertions, 1 deletions
diff --git a/db/seeds.rb b/db/seeds.rb
index 5f43fbac8..b112cf073 100644
--- a/db/seeds.rb
+++ b/db/seeds.rb
@@ -1,7 +1,8 @@
 Doorkeeper::Application.create!(name: 'Web', superapp: true, redirect_uri: Doorkeeper.configuration.native_redirect_uri, scopes: 'read write follow')
 
 domain = ENV['LOCAL_DOMAIN'] || Rails.configuration.x.local_domain
-Account.create!(id: -99, actor_type: 'Application', locked: true, username: domain)
+account = Account.find_or_initialize_by(id: -99, actor_type: 'Application', locked: true, username: domain)
+account.save!
 
 if Rails.env.development?
   admin  = Account.where(username: 'admin').first_or_initialize(username: 'admin')