Module: PGTrunk::Migrator

Defined in:
lib/pg_trunk/core/railtie/migrator.rb

Overview

This module extends the ActiveRecord::Migrator to clean the gem-specific registry pg_trunk:

  • set version to rows added by the current migration
  • delete rows that refer to objects deleted by the migration

We need this because some objects (like check constraints, indexes etc.) can be dropped along with the table they refer to. This depencency is implicit-ish. That's why we have to check the presence of all objects in pg_trunk after every single migration.

Instance Method Summary collapse

Instance Method Details

#record_version_state_after_migratingObject



17
18
19
20
# File 'lib/pg_trunk/core/railtie/migrator.rb', line 17

def record_version_state_after_migrating(*)
  super
  PGTrunk::Registry.finalize
end