Skip to content

Commit

Permalink
Additional warnings fixes
Browse files Browse the repository at this point in the history
Additional instances of fix for "character class has duplicate range" in
regexp, removing the underscore "_" after the "\w", which caused the
warnings
  • Loading branch information
andyatkinson committed Sep 22, 2024
1 parent 78a435c commit c5f0096
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/activerecord-clean-db-structure/clean_dump.rb
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def run
partitioned_tables += dump.scan(partitioned_tables_regexp1).map(&:last)

# Earlier versions use an inline PARTITION OF
partitioned_tables_regexp2 = /-- Name: ([\w_\.]+); Type: TABLE\n\n[^;]+?PARTITION OF [\w_\.]+\n[^;]+?;/m
partitioned_tables_regexp2 = /-- Name: ([\w\.]+); Type: TABLE\n\n[^;]+?PARTITION OF [\w\.]+\n[^;]+?;/m
partitioned_tables += dump.scan(partitioned_tables_regexp2).map(&:first)

partitioned_tables.each do |partitioned_table|
Expand All @@ -104,7 +104,7 @@ def run
dump.gsub!(/-- Name: #{partitioned_table}_pkey; Type: INDEX ATTACH\n\n[^;]+?ATTACH PARTITION ([\w_]+\.)?#{partitioned_table}_pkey;/, '')
end
# This is mostly done to allow restoring Postgres 11 output on Postgres 10
dump.gsub!(/CREATE INDEX ([\w_]+) ON ONLY/, 'CREATE INDEX \\1 ON')
dump.gsub!(/CREATE INDEX ([\w]+) ON ONLY/, 'CREATE INDEX \\1 ON')

if options[:order_schema_migrations_values] == true
schema_migrations_cleanup
Expand Down

0 comments on commit c5f0096

Please sign in to comment.