]> cat aescling's git repositories - mastodon.git/commitdiff
Not to create an account if already exist (#11366)
authorysksn <bluewhale1982@gmail.com>
Sun, 21 Jul 2019 01:40:08 +0000 (10:40 +0900)
committerEugen Rochko <eugen@zeonfederated.com>
Sun, 21 Jul 2019 01:40:08 +0000 (03:40 +0200)
db/seeds.rb

index 5f43fbac8bbe28a2612348eaf4295da3c6410c1a..b112cf07382eb4cf8f0224dcb6692f883d3f1670 100644 (file)
@@ -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')