Class: Pakyow::Data::Adapters::Sql::Migrators::Finalizer Private

Inherits:
Pakyow::Data::Adapters::Sql::Migrator show all
Defined in:
lib/pakyow/data/adapters/sql/migrators/finalizer.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Defined Under Namespace

Classes: Writer

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Pakyow::Data::Adapters::Sql::Migrator

adapter_methods_for_adapter, #change_source!, #change_source?, #create_source!, #create_source?, #disconnect!, globalize_connection_opts!, #reassociate_source!

Methods inherited from Sources::Relational::Migrator

#auto_migrate!, #finalize!

Constructor Details

#initializeFinalizer

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Finalizer.



14
15
16
17
# File 'lib/pakyow/data/adapters/sql/migrators/finalizer.rb', line 14

def initialize(*)
  super
  @migrations = []
end

Instance Attribute Details

#migrationsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
# File 'lib/pakyow/data/adapters/sql/migrators/finalizer.rb', line 12

def migrations
  @migrations
end

Instance Method Details

#alter_table(name, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
34
35
# File 'lib/pakyow/data/adapters/sql/migrators/finalizer.rb', line 31

def alter_table(name, &block)
  writer = Writer.new(root: true)
  writer.alter_table(name, &block)
  @migrations << ["change_#{name}", writer]
end

#associate_table(name, with:, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



25
26
27
28
29
# File 'lib/pakyow/data/adapters/sql/migrators/finalizer.rb', line 25

def associate_table(name, with:, &block)
  writer = Writer.new(root: true)
  writer.alter_table(name, &block)
  @migrations << ["associate_#{name}_with_#{with}", writer]
end

#create_table(name, &block) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



19
20
21
22
23
# File 'lib/pakyow/data/adapters/sql/migrators/finalizer.rb', line 19

def create_table(name, &block)
  writer = Writer.new(root: true)
  writer.create_table(name, &block)
  @migrations << ["create_#{name}", writer]
end