lib/pg_trunk/operations/enums/change_enum.rb
# Add new value (irreversible!)
# If neither option is specified, the value will be added
# to the very end of the array.
# Notice, that all add-ons are made BEFORE renames.
Add new value (irreversible!)
If neither option is specified, the value will be added
to the very end of the array.
Notice, that all add-ons are made BEFORE renames.
Add new value ( irreversible! ) If neither option is specified the value will be added to the very end of the array . Notice that all add - ons are made BEFORE renames .
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
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
Add new value (irreversible!)
Add new value ( irreversible! )