You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: change_enum.rb
    path of file: ./repos/pg_trunk/lib/pg_trunk/operations/enums
    
    the code of the file until where you have to start completion: # frozen_string_literal: false

# @!parse
#   class ActiveRecord::Migration
#     # Modify an enumerated type
#     #
#     # @param [#to
    
    def invert
      values_added = changes.any?(&:add?)
      raise IrreversibleMigration.new(self, nil, <<~MSG.squish) if values_added
        Removal of values from enumerated type is not supported by PostgreSQL,
        that's why adding new values can't be reverted.
      MSG

      undefined = inversion.select { |_, v| v.nil? }.keys.join(", ").presence
      raise IrreversibleMigration.new(self, nil, <<~MSG.squish) if undefined
        Undefined values to revert #{undefined}.
      MSG

      self.class.new(**to_h, **inversion)
    end