Sha256: 261d7c8047645270ef51997aee413bf52317f719b27dc74c796df69cc0195c97

Contents?: true

Size: 1.04 KB

Versions: 7

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

module Torque
  module PostgreSQL
    module Migration
      module CommandRecorder

        # Records the rename operation for types
        def rename_type(*args, &block)
          record(:rename_type, args, &block)
        end

        # Inverts the type rename operation
        def invert_rename_type(args)
          [:rename_type, args.reverse]
        end

        # Records the creation of a schema
        def create_schema(*args, &block)
          record(:create_schema, args, &block)
        end

        # Inverts the creation of a schema
        def invert_create_schema(args)
          [:drop_schema, [args.first]]
        end

        # Records the creation of the enum to be reverted.
        def create_enum(*args, &block)
          record(:create_enum, args, &block)
        end

        # Inverts the creation of the enum.
        def invert_create_enum(args)
          [:drop_type, [args.first]]
        end

      end

      ActiveRecord::Migration::CommandRecorder.include CommandRecorder
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
torque-postgresql-2.4.5 lib/torque/postgresql/migration/command_recorder.rb
torque-postgresql-2.4.4 lib/torque/postgresql/migration/command_recorder.rb
torque-postgresql-2.4.3 lib/torque/postgresql/migration/command_recorder.rb
torque-postgresql-2.4.2 lib/torque/postgresql/migration/command_recorder.rb
torque-postgresql-2.4.1 lib/torque/postgresql/migration/command_recorder.rb
torque-postgresql-2.4.0 lib/torque/postgresql/migration/command_recorder.rb
torque-postgresql-2.3.0 lib/torque/postgresql/migration/command_recorder.rb