For heroku, check if necessary table exist before trying to precompile assets

This commit is contained in:
Neil Lalonde 2014-06-12 14:41:37 -04:00
parent efc70a2bca
commit 17f0777d14

View file

@ -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