From 17f0777d14138da12b08f0be6e195d3d2c5f2c0f Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Thu, 12 Jun 2014 14:41:37 -0400 Subject: [PATCH] For heroku, check if necessary table exist before trying to precompile assets --- lib/tasks/assets.rake | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lib/tasks/assets.rake b/lib/tasks/assets.rake index 4dcb090ca4f..184144c8383 100644 --- a/lib/tasks/assets.rake +++ b/lib/tasks/assets.rake @@ -48,9 +48,13 @@ end task 'assets:precompile:css' => 'environment' do RailsMultisite::ConnectionManagement.each_connection do |db| - puts "Compiling css for #{db}" - [:desktop, :mobile].each do |target| - puts DiscourseStylesheets.compile(target, force: true) + # Heroku precompiles assets before db migration, so tables may not exist. + # css will get precompiled during first request instead in that case. + if ActiveRecord::Base.connection.table_exists?(ColorScheme.table_name) + puts "Compiling css for #{db}" + [:desktop, :mobile].each do |target| + puts DiscourseStylesheets.compile(target, force: true) + end end end end