Class: ActiveRecord::ConnectionAdapters::SchemaDefinition
- Inherits:
-
Struct
- Object
- Struct
- ActiveRecord::ConnectionAdapters::SchemaDefinition
- Includes:
- SchemaProcs
- Defined in:
- lib/connection_adapters/schema_definition.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#owner ⇒ Object
Returns the value of attribute owner.
Instance Method Summary collapse
- #to_rdl ⇒ Object
-
#to_sql(action = "create", options = {}) ⇒ Object
CREATE SCHEMA schemaname [ AUTHORIZATION username ] [ schema_element [ … ] ] DROP SCHEMA [ IF EXISTS ] name [, …] [ CASCADE | RESTRICT ].
Methods included from SchemaProcs
#behavior, #cascade_or_restrict, #definer_or_invoker, #strict_or_null
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name
3 4 5 |
# File 'lib/connection_adapters/schema_definition.rb', line 3 def name @name end |
#owner ⇒ Object
Returns the value of attribute owner
3 4 5 |
# File 'lib/connection_adapters/schema_definition.rb', line 3 def owner @owner end |
Instance Method Details
#to_rdl ⇒ Object
6 7 8 |
# File 'lib/connection_adapters/schema_definition.rb', line 6 def to_rdl " create_schema #{name.to_sql_name}, #{owner.to_sql_name}" end |
#to_sql(action = "create", options = {}) ⇒ Object
CREATE SCHEMA schemaname [ AUTHORIZATION username ] [ schema_element [ … ] ]
DROP SCHEMA [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ]
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/connection_adapters/schema_definition.rb', line 12 def to_sql(action="create", ={}) 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([:cascade])}" # TODO - [ IF EXISTS ] end end |