From db678948aba130425b2a4651e46ea7a7cc75721e Mon Sep 17 00:00:00 2001 From: Alban Peignier Date: Mon, 8 Jan 2018 09:26:04 +0100 Subject: Avoid error into Referetial#create_schema can't read migration count --- app/models/referential.rb | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'app') diff --git a/app/models/referential.rb b/app/models/referential.rb index a5d5acbf9..4cddd502e 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -156,7 +156,7 @@ class Referential < ActiveRecord::Base def stop_points Chouette::StopPoint.all end - + def compliance_check_sets ComplianceCheckSet.all end @@ -356,7 +356,13 @@ class Referential < ActiveRecord::Base end Rails.logger.info("Schema create benchmark: '#{slug}'\t#{report}") - Rails.logger.error( "Schema migrations count for Referential #{slug} " + Referential.connection.select_value("select count(*) from #{slug}.schema_migrations;").to_s ) + Rails.logger.info("Schema migrations count for Referential #{slug}: #{migration_count || '-'}") + end + end + + def migration_count + if self.class.connection.table_exists?("#{slug}.schema_migrations") + self.class.connection.select_value("select count(*) from #{slug}.schema_migrations;") end end -- cgit v1.2.3