class PGTrunk::Operation::IrreversibleMigration

@private The exception to be thrown when reversed migration isn’t valid

Public Class Methods

new(operation, inversion, *messages) click to toggle source
Calls superclass method
# File lib/pg_trunk/core/operation/inversion.rb, line 9
def initialize(operation, inversion, *messages)
  msg = "#{header(operation)}#{inverted(inversion)} #{footer(messages)}"
  super(msg.strip)
end

Private Instance Methods

header(operation) click to toggle source
# File lib/pg_trunk/core/operation/inversion.rb, line 14
    def header(operation)
      <<~MSG
        This migration uses the operation:

          #{operation.to_ruby.indent(2).strip}

      MSG
    end
inverted(inversion) click to toggle source
# File lib/pg_trunk/core/operation/inversion.rb, line 23
    def inverted(inversion)
      return "which is not automatically reversible" unless inversion

      <<~MSG.strip
        whose inversion would be like:

          #{inversion.to_ruby.indent(2).strip}

        which is invalid
      MSG
    end