From 379095d8881663edcb0faf0ce50937733f9ca2e3 Mon Sep 17 00:00:00 2001 From: Andy Strominger Date: Tue, 17 May 2022 11:31:44 -0400 Subject: [PATCH] Fix schema.rb with ActiveRecord::Schema[7.0].define --- lib/hair_trigger.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/hair_trigger.rb b/lib/hair_trigger.rb index b8acb0d..af968c8 100644 --- a/lib/hair_trigger.rb +++ b/lib/hair_trigger.rb @@ -82,7 +82,7 @@ def current_migrations(options = {}) if previous_schema = (options.has_key?(:previous_schema) ? options[:previous_schema] : File.exist?(schema_rb_path) && File.read(schema_rb_path)) base_triggers = MigrationReader.get_triggers(previous_schema, options) unless base_triggers.empty? - version = (previous_schema =~ /ActiveRecord::Schema\.define\(.*?(\d+)\)/) && $1.to_i + version = (previous_schema =~ /ActiveRecord::Schema(\[\d\.\d\])?\.define\(.*?(\d+)\)/) && $1.to_i migrations.unshift [OpenStruct.new({:version => version}), base_triggers] end end