activerecord-postgis-adapter 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 530465c0f3d1c6114a70cc680aeac76cfc92b4fa
|
4
|
+
data.tar.gz: a38593f010a53528501f14ea121698925a72f4b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d94f15877a0a8bb54c37be063812c9af9d50bc43b2fb8ff2e822a6cb6811a1371d77b83be476a66d41276b37d60535f5c1bc6b20f7c43aea8ee8fc66d1141992
|
7
|
+
data.tar.gz: 5b095db94a92fd53bdd7775875c45b447c6e609b0b5f7970a365c059687bd4e97f3a80dedcadc9aa492a5747227c56925b95bc521b50bcf78e8c61f63eb9d081
|
@@ -114,14 +114,17 @@ module ActiveRecord # :nodoc:
|
|
114
114
|
end
|
115
115
|
table_definition.non_geographic_spatial_columns.each do |col|
|
116
116
|
options = {
|
117
|
+
default: col.default,
|
117
118
|
has_m: col.has_m?,
|
118
119
|
has_z: col.has_z?,
|
120
|
+
null: col.null,
|
119
121
|
srid: col.srid,
|
120
122
|
type: col.spatial_type,
|
121
123
|
}
|
122
124
|
column_name = col.name.to_s
|
125
|
+
type = col.spatial_type
|
123
126
|
|
124
|
-
add_spatial_column(table_name, column_name, options)
|
127
|
+
add_spatial_column(table_name, column_name, type, options)
|
125
128
|
end
|
126
129
|
end
|
127
130
|
|
@@ -129,7 +132,8 @@ module ActiveRecord # :nodoc:
|
|
129
132
|
table_name = table_name.to_s
|
130
133
|
column_name = column_name.to_s
|
131
134
|
if (info = spatial_column_constructor(type.to_sym))
|
132
|
-
|
135
|
+
options[:info] = info
|
136
|
+
add_spatial_column(table_name, column_name, type, options)
|
133
137
|
else
|
134
138
|
super
|
135
139
|
end
|
@@ -163,8 +167,9 @@ module ActiveRecord # :nodoc:
|
|
163
167
|
|
164
168
|
private
|
165
169
|
|
166
|
-
def add_spatial_column(table_name, column_name,
|
170
|
+
def add_spatial_column(table_name, column_name, type, options)
|
167
171
|
limit = options[:limit]
|
172
|
+
info = options[:info] || {}
|
168
173
|
options.merge!(limit) if limit.is_a?(::Hash)
|
169
174
|
type = (options[:type] || info[:type] || type).to_s.gsub('_', '').upcase
|
170
175
|
has_z = options[:has_z]
|
@@ -180,6 +185,7 @@ module ActiveRecord # :nodoc:
|
|
180
185
|
type = "#{type}M" if has_m && !has_z
|
181
186
|
dimensions = set_dimensions(has_m, has_z)
|
182
187
|
execute("SELECT AddGeometryColumn('#{quote_string(table_name)}', '#{quote_string(column_name)}', #{srid}, '#{quote_string(type)}', #{dimensions})")
|
188
|
+
change_column_null(table_name, column_name, false, options[:default]) if options[:null] == false
|
183
189
|
end
|
184
190
|
end
|
185
191
|
|
data/test/ddl_test.rb
CHANGED
@@ -82,11 +82,14 @@ class DDLTest < ActiveSupport::TestCase # :nodoc:
|
|
82
82
|
def test_add_geometry_column_null_false
|
83
83
|
klass = create_ar_class
|
84
84
|
klass.connection.create_table(:spatial_test) do |t|
|
85
|
-
t.column('
|
85
|
+
t.column('latlon_null', :geometry, null: false)
|
86
|
+
t.column('latlon', :geometry)
|
86
87
|
end
|
87
|
-
|
88
|
+
null_false_column = klass.columns[1]
|
89
|
+
null_true_column = klass.columns[2]
|
88
90
|
|
89
|
-
refute(
|
91
|
+
refute(null_false_column.null, 'Column should be null: false')
|
92
|
+
assert(null_true_column.null, 'Column should be null: true')
|
90
93
|
end
|
91
94
|
|
92
95
|
def test_add_geography_column
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord-postgis-adapter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Azuma, Tee Parham
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activerecord
|
@@ -30,14 +30,14 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 1.0
|
33
|
+
version: '1.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 1.0
|
40
|
+
version: '1.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|