Class: ActiveRecord::ConnectionAdapters::TypeDefinition

Inherits:
Struct
  • Object
show all
Defined in:
lib/connection_adapters/type_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#columnsObject

Returns the value of attribute columns



3
4
5
# File 'lib/connection_adapters/type_definition.rb', line 3

def columns
  @columns
end

#idObject

Returns the value of attribute id



3
4
5
# File 'lib/connection_adapters/type_definition.rb', line 3

def id
  @id
end

#nameObject

Returns the value of attribute name



3
4
5
# File 'lib/connection_adapters/type_definition.rb', line 3

def name
  @name
end

Instance Method Details

#to_sql(action = "create", options = {}) ⇒ Object



5
6
7
8
9
10
11
12
13
14
# File 'lib/connection_adapters/type_definition.rb', line 5

def to_sql(action="create", options={})
  case action
    when "create", :create
        "CREATE SCHEMA #{name.to_sql_name} AUTHORIZATION #{owner.to_sql_name}"
    # TODO - [ schema_element ]
    when "drop", :drop
      "DROP SCHEMA #{name.to_sql_name} #{cascade_or_restrict(options[:cascade])}"
    # TODO - [ IF EXISTS ]
  end
end