Exception: Vcs4sql::ChecksumMismatchError

Inherits:
Vcs4sqlError
  • Object
show all
Defined in:
lib/vcs4sql/exception.rb

Instance Attribute Summary

Attributes inherited from Vcs4sqlError

#code

Instance Method Summary collapse

Constructor Details

#initialize(expected, applied) ⇒ ChecksumMismatchError



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/vcs4sql/exception.rb', line 34

def initialize(expected, applied)
  msg = "    Version '\#{expected.version}' has checksum mismatch.\n\n    The possible root cause is that the file with migration, which was applied already, got changed recently.\n    As a workaround, you may change the md5sum in the database in case if these changes are minor\n    and don't affect the structure:\n    update changelog set md5sum='\#{expected.md5sum}' where id=\#{applied.id}\n\n    In case if changes are major and affect the database structure then they should be reverted\n    and introduce it as a new change.\n\n    Expected '\#{expected.version}' version from '\#{expected.file}' (\#{expected.md5sum}) has SQL:\n    \#{expected.sql}\n    .............................................................................................\n    Existing '\#{applied.version}' version from '\#{applied.file}' (\#{applied.md5sum}) has SQL:\n    \#{applied.sql}\n    .............................................................................................\n  MSG\n  super(\"vcs4sql-001\", msg)\nend\n"