Class: Nandi::Instructions::CreateTable

Inherits:
Object
  • Object
show all
Defined in:
lib/nandi/instructions/create_table.rb

Defined Under Namespace

Classes: ColumnsReader

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(table:, columns_block:, **kwargs) ⇒ CreateTable

Returns a new instance of CreateTable.



10
11
12
13
14
15
16
17
# File 'lib/nandi/instructions/create_table.rb', line 10

def initialize(table:, columns_block:, **kwargs)
  @table = table
  columns_reader = ColumnsReader.new
  columns_block.call(columns_reader)
  @columns = columns_reader.columns
  @extra_args = kwargs unless kwargs.empty?
  @timestamps_args = columns_reader.timestamps_args
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



8
9
10
# File 'lib/nandi/instructions/create_table.rb', line 8

def columns
  @columns
end

#extra_argsObject (readonly)

Returns the value of attribute extra_args.



8
9
10
# File 'lib/nandi/instructions/create_table.rb', line 8

def extra_args
  @extra_args
end

#tableObject (readonly)

Returns the value of attribute table.



8
9
10
# File 'lib/nandi/instructions/create_table.rb', line 8

def table
  @table
end

#timestamps_argsObject (readonly)

Returns the value of attribute timestamps_args.



8
9
10
# File 'lib/nandi/instructions/create_table.rb', line 8

def timestamps_args
  @timestamps_args
end

Instance Method Details

#lockObject



23
24
25
# File 'lib/nandi/instructions/create_table.rb', line 23

def lock
  Nandi::Migration::LockWeights::ACCESS_EXCLUSIVE
end

#procedureObject



19
20
21
# File 'lib/nandi/instructions/create_table.rb', line 19

def procedure
  :create_table
end