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 3902af477e9fd96fb4818d7ac7bde0d4fa11c1cf..d42408f9ed75e196293af3163ab2e0184e918f19 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"