class Vcs4sql::ChecksumMismatchError

Public Class Methods

new(expected, applied) click to toggle source
Calls superclass method Vcs4sql::Vcs4sqlError::new
# File lib/vcs4sql/exception.rb, line 34
    def initialize(expected, applied)
      msg = <<~MSG
        Version '#{expected.version}' has checksum mismatch.

        The possible root cause is that the file with migration, which was applied already, got changed recently.
        As a workaround, you may change the md5sum in the database in case if these changes are minor
        and don't affect the structure:
        update changelog set md5sum='#{expected.md5sum}' where id=#{applied.id}

        In case if changes are major and affect the database structure then they should be reverted
        and introduce it as a new change.

        Expected '#{expected.version}' version from '#{expected.file}' (#{expected.md5sum}) has SQL:
        #{expected.sql}
        .............................................................................................
        Existing '#{applied.version}' version from '#{applied.file}' (#{applied.md5sum}) has SQL:
        #{applied.sql}
        .............................................................................................
      MSG
      super("vcs4sql-001", msg)
    end