diff options
Diffstat (limited to 'app/models/referential.rb')
| -rw-r--r-- | app/models/referential.rb | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/app/models/referential.rb b/app/models/referential.rb index 932000174..3eb5d3283 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -360,8 +360,18 @@ class Referential < ActiveRecord::Base Apartment::Tenant.create slug 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 ) + check_migration_count(report) + end + end + + def check_migration_count(report) + Rails.logger.info("Schema create benchmark: '#{slug}'\t#{report}") + Rails.logger.info("Schema migrations count for Referential #{slug}: #{migration_count || '-'}") + 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 @@ -451,7 +461,7 @@ class Referential < ActiveRecord::Base # No explicit unlock is needed as it will be released at the end of the # transaction. ActiveRecord::Base.connection.execute( - 'LOCK referentials IN ACCESS EXCLUSIVE MODE' + 'LOCK public.referentials IN ACCESS EXCLUSIVE MODE' ) end end |
