Fix dev instance setup script to detect db:migrate mode better
authorTom Hughes <tom@compton.nu>
Fri, 18 Aug 2017 08:04:32 +0000 (09:04 +0100)
committerTom Hughes <tom@compton.nu>
Fri, 18 Aug 2017 08:04:32 +0000 (09:04 +0100)
cookbooks/dev/templates/default/rails.setup.rb.erb

index 3902af4..d42408f 100644 (file)
@@ -1,5 +1,5 @@
-unless Object.const_defined?(:Rake) or Object.const_defined?(:POTLATCH2_KEY)
-  OpenStreetMap::Application.config.after_initialize do
+OpenStreetMap::Application.config.after_initialize do
+  if ActiveRecord::Base.connection.table_exists?(:client_applications)
     unless webmaster = User.find_by_email("webmaster@openstreetmap.org")
       webmaster = User.new
       webmaster.display_name = "OpenStreetMap Webmaster"