diff --git a/lib/activerecord-clean-db-structure/clean_dump.rb b/lib/activerecord-clean-db-structure/clean_dump.rb index 4a25860..76faa25 100644 --- a/lib/activerecord-clean-db-structure/clean_dump.rb +++ b/lib/activerecord-clean-db-structure/clean_dump.rb @@ -180,23 +180,6 @@ def primary_keys_cleanup end end end - - # Orders the columns definitions alphabetically - # - ignores quotes which surround column names that are equal to reserved PostgreSQL names. - # - keeps the columns at the top and places the constraints at the bottom. - def order_column_definitions - dump.gsub!(/^(?CREATE TABLE .+?\(\n)(?.+?)(?=\n\);$)/m) do - columns = - $~[:columns] - .split(",\n") - .sort_by { |column| column[/[^ "]+/] } - .partition { |column| !column.match?(/\A *CONSTRAINT/) } - .flatten - .join(",\n") - - [$~[:table], columns].join - end - end # Moves the separate unique constraint statements to the create table statements. def move_unique_constraints