Skip to content

Commit

Permalink
Merge pull request #47428 from fatkodima/optimize-schema_dumper-ignore
Browse files Browse the repository at this point in the history
Optimize `SchemaDumper`s check for ignored tables
  • Loading branch information
yahonda committed Feb 20, 2023
1 parent d6c5d38 commit 09ea3ec
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions activerecord/lib/active_record/schema_dumper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,10 @@ def format_index_parts(options)
end

def remove_prefix_and_suffix(table)
# This method appears at the top when profiling active_record test cases run.
# Avoid costly calculation when there are no prefix and suffix.
return table if @options[:table_name_prefix].blank? && @options[:table_name_suffix].blank?

prefix = Regexp.escape(@options[:table_name_prefix].to_s)
suffix = Regexp.escape(@options[:table_name_suffix].to_s)
table.sub(/\A#{prefix}(.+)#{suffix}\z/, "\\1")
Expand Down

0 comments on commit 09ea3ec

Please sign in to comment.