module PGTrunk::Operation::Inversion

@private Enable operations to be invertible

Public Instance Methods

invert!() click to toggle source

@private

# File lib/pg_trunk/core/operation/inversion.rb, line 56
def invert!
  invert&.tap do |i|
    i.valid? || raise(IrreversibleMigration.new(self, i, *i.error_messages))
  end
end
irreversible!(option) click to toggle source

@private

# File lib/pg_trunk/core/operation/inversion.rb, line 63
    def irreversible!(option)
      raise IrreversibleMigration.new(self, nil, <<~MSG.squish)
        The operation with the `#{option}` option cannot be reversed
          due to uncertainty of the previous state of the database.
      MSG
    end