Class: ROM::SQL::Schema

Inherits:
ROM::Schema
  • Object
show all
Defined in:
lib/rom/sql/schema.rb,
lib/rom/sql/schema/dsl.rb,
lib/rom/sql/schema/inferrer.rb,
lib/rom/sql/schema/associations_dsl.rb,
lib/rom/sql/extensions/postgres/inferrer.rb

Defined Under Namespace

Classes: AssociationsDSL, DSL, Inferrer, PostgresInferrer

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeSchema

Returns a new instance of Schema.



16
17
18
19
20
# File 'lib/rom/sql/schema.rb', line 16

def initialize(*)
  super
  @primary_key_name = nil
  @primary_key_names = EMPTY_ARRAY
end

Instance Attribute Details

#primary_key_nameObject (readonly)

Returns the value of attribute primary_key_name.



10
11
12
# File 'lib/rom/sql/schema.rb', line 10

def primary_key_name
  @primary_key_name
end

#primary_key_namesObject (readonly)

Returns the value of attribute primary_key_names.



14
15
16
# File 'lib/rom/sql/schema.rb', line 14

def primary_key_names
  @primary_key_names
end

Instance Method Details

#finalize!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.



23
24
25
26
27
28
29
30
# File 'lib/rom/sql/schema.rb', line 23

def finalize!(*)
  super do
    if primary_key.size > 0
      @primary_key_name = primary_key[0].meta[:name]
      @primary_key_names = primary_key.map { |type| type.meta[:name] }
    end
  end
end