Sha256: f417a0ff84b0bb64f58e1ee43c6fed9091302ee78b8279bbc3dbbfd35e343a34

Contents?: true

Size: 676 Bytes

Versions: 5

Compression:

Stored size: 676 Bytes

Contents

# frozen_string_literal: true

module PGTrunk
  # @private
  # The module adds commands to execute DDL operations in PostgreSQL.
  module Statements
    # @param [PGTrunk::Operation] klass
    def self.register(klass)
      define_method(klass.ruby_name) do |*args, &block|
        operation = klass.from_ruby(*args, &block)
        operation.validate!
        PGTrunk.database.execute_operation(operation)
      end
    end

    # A command does nothing when a unidirectional command is inverted
    # (for example, when a foreign key validation is inverted).
    # This case is different from those when an inversion cannot be made.
    def skip_inversion(*); 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/statements.rb
pg_trunk-0.1.3 lib/pg_trunk/core/railtie/statements.rb
pg_trunk-0.1.2 lib/pg_trunk/core/railtie/statements.rb
pg_trunk-0.1.1 lib/pg_trunk/core/railtie/statements.rb
pg_trunk-0.1.0 lib/pg_trunk/core/railtie/statements.rb