Sha256: 366b8908560a803a7fa4d97543d216595af7ef11442a1db936f4c91cb31440e3

Contents?: true

Size: 697 Bytes

Versions: 5

Compression:

Stored size: 697 Bytes

Contents

# frozen_string_literal: true

module PGTrunk
  # @private
  # 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.
  module Migrator
    def record_version_state_after_migrating(*)
      super
      PGTrunk::Registry.finalize
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
pg_trunk-0.2.0 lib/pg_trunk/core/railtie/migrator.rb
pg_trunk-0.1.3 lib/pg_trunk/core/railtie/migrator.rb
pg_trunk-0.1.2 lib/pg_trunk/core/railtie/migrator.rb
pg_trunk-0.1.1 lib/pg_trunk/core/railtie/migrator.rb
pg_trunk-0.1.0 lib/pg_trunk/core/railtie/migrator.rb