4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/activerecord-postgres-postgis/active_record/connection_adapters/schema_statements.rb', line 4
def add_column_options_with_spatial!(sql, options)
column = options.fetch(:column) { return super }
if column.type == :geometry
if column.spatial_type || column.srid
sql_params = column.spatial_type
sql_params << ',' if sql_params && column.srid
sql_params = column.srid.to_s.prepend(sql_params || '') if column.srid
sql << "(#{sql_params})" if sql_params
end
elsif column.type == :geography
if column.spatial_type || column.srid
sql_params = column.spatial_type
sql_params << ',' if sql_params
sql_params = 4326.to_s.prepend(sql_params || '')
sql << "(#{sql_params})" if sql_params
end
else
add_column_options_without_spatial!(sql, options)
end
end
|