Class: ActiveRecord::ConnectionAdapters::AbstractAdapter::SchemaCreation
- Defined in:
- activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb
Overview
:nodoc:
Direct Known Subclasses
ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter::SchemaCreation, PostgreSQLAdapter::SchemaCreation
Instance Method Summary collapse
- #accept(o) ⇒ Object
-
#initialize(conn) ⇒ SchemaCreation
constructor
A new instance of SchemaCreation.
- #visit_AddColumn(o) ⇒ Object
Constructor Details
#initialize(conn) ⇒ SchemaCreation
Returns a new instance of SchemaCreation.
5 6 7 8 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb', line 5 def initialize(conn) @conn = conn @cache = {} end |
Instance Method Details
#accept(o) ⇒ Object
10 11 12 13 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb', line 10 def accept(o) m = @cache[o.class] ||= "visit_#{o.class.name.split('::').last}" send m, o end |
#visit_AddColumn(o) ⇒ Object
15 16 17 18 19 |
# File 'activerecord/lib/active_record/connection_adapters/abstract/schema_creation.rb', line 15 def visit_AddColumn(o) sql_type = type_to_sql(o.type.to_sym, o.limit, o.precision, o.scale) sql = "ADD #{quote_column_name(o.name)} #{sql_type}" (sql, (o)) end |