Module: AeCheckMigrationsLoadSilently

Includes:
Minitest::Assertions
Defined in:
lib/ae_check_migrations_load_silently.rb,
lib/ae_check_migrations_load_silently/version.rb

Constant Summary collapse

VERSION =
'1.5.0'

Instance Method Summary collapse

Instance Method Details

#check_all_migrations_load_silentlyObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/ae_check_migrations_load_silently.rb', line 9

def check_all_migrations_load_silently
  before_checksums = get_database_checksums
  load_all_migrations
  after_checksums = get_database_checksums

  tables_modified = (
  (before_checksums - after_checksums).map(&:first) +
    (after_checksums - before_checksums).map(&:first)
  ).uniq

  if tables_modified.present?
    error_message = "      The following tables were modified when the migration classes were\n      loaded. This is not compatible with our release process. This is likely\n      because the migration has database modifying code on the\n      class rather than inside a method.\n      \#{tables_modified.sort.join(\"\\n\")}\n    MSG\n\n    flunk error_message\n  end\nend\n"