Module: ActiveRecord::ConnectionAdapters::PostGIS::ColumnMethods
- Defined in:
- lib/active_record/connection_adapters/postgis/column_methods.rb
Instance Method Summary collapse
-
#new_column_from_field(table_name, field, _definitions) ⇒ Object
Override to handle PostGIS types in column definitions.
Instance Method Details
#new_column_from_field(table_name, field, _definitions) ⇒ Object
Override to handle PostGIS types in column definitions
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/active_record/connection_adapters/postgis/column_methods.rb', line 8 def new_column_from_field(table_name, field, _definitions) column_name = field["column_name"] = (column_name, field["data_type"], field["sql_type"], field) # Handle PostGIS types if field["sql_type"] =~ /geometry|geography/i = (field["sql_type"], ) end default_value = extract_value_from_default(field["column_default"]) default_function = extract_default_function(field["column_default"], default_value) PostgreSQL::Column.new( column_name, default_value, , field["is_nullable"] == "YES", default_function, comment: field["comment"].presence ) end |