Skip to content

Commit

Permalink
Merge pull request #104 from maestromac/patch-1
Browse files Browse the repository at this point in the history
Update previous_schema regex to account for Rails 7
  • Loading branch information
jenseng authored Dec 12, 2022
2 parents 0e54993 + 5b8cf01 commit 123c36a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/hair_trigger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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\(version\: (.*)\)/) && $2.to_i
migrations.unshift [OpenStruct.new({:version => version}), base_triggers]
end
end
Expand Down

0 comments on commit 123c36a

Please sign in to comment.