Module: PGTrunk::Statements

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

Overview

The module adds commands to execute DDL operations in PostgreSQL.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.register(klass) ⇒ Object

Parameters:



8
9
10
11
12
13
14
# File 'lib/pg_trunk/core/railtie/statements.rb', line 8

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

Instance Method Details

#skip_inversionObject

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.



19
# File 'lib/pg_trunk/core/railtie/statements.rb', line 19

def skip_inversion(*); end