class G2R::RDBMS::Column

Attributes

name[RW]

Public Class Methods

new(name) click to toggle source
# File lib/graph2relational/rdbms-column.rb, line 6
def initialize(name)
  @name = RDBMS.transform_name(name)
  @primary_key = false
  @foreign_key = false
end

Public Instance Methods

==(other_column) click to toggle source
# File lib/graph2relational/rdbms-column.rb, line 12
def ==(other_column)
  @name == other_column.name
end
foreign_key(target_table) click to toggle source

FOREIGN KEY

Define the column as a foreign key

# File lib/graph2relational/rdbms-column.rb, line 34
def foreign_key(target_table)
  @foreign_key = true
  @target_table = RDBMS.transform_name(target_table)
  self
end
foreign_key?() click to toggle source

Check if the column is a foreign key

# File lib/graph2relational/rdbms-column.rb, line 41
def foreign_key?
  @foreign_key
end
primary_key() click to toggle source

PRIMARY KEY

Define the column as a primary key

# File lib/graph2relational/rdbms-column.rb, line 20
def primary_key
  @primary_key = true
  self
end
primary_key?() click to toggle source

Checks if the column is a primary key

# File lib/graph2relational/rdbms-column.rb, line 26
def primary_key?
  @primary_key
end
target_table() click to toggle source

Table the foreign key is targeting

# File lib/graph2relational/rdbms-column.rb, line 46
def target_table
  @target_table
end