From 02cd9a9e5d05ab9858e6de27e38cd6b56b919d69 Mon Sep 17 00:00:00 2001 From: Alban Peignier Date: Thu, 22 Feb 2018 19:18:26 +0100 Subject: Add a spec to verify to Referential migration count after creation. Refs #6010 --- app/models/referential.rb | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/models/referential.rb b/app/models/referential.rb index 3b770603a..91a88d02d 100644 --- a/app/models/referential.rb +++ b/app/models/referential.rb @@ -408,6 +408,7 @@ class Referential < ActiveRecord::Base end check_migration_count(report) + # raise "Wrong migration count: #{migration_count}" if migration_count < 300 end end @@ -417,9 +418,12 @@ class Referential < ActiveRecord::Base 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 + raw_value = + if self.class.connection.table_exists?("#{slug}.schema_migrations") + self.class.connection.select_value("select count(*) from #{slug}.schema_migrations;") + end + + raw_value.to_i end def assign_slug(time_reference = Time) -- cgit v1.2.3