spatial_adapter 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -28,9 +28,13 @@ dependencies as well.
28
28
 
29
29
  gem install spatial_adapter
30
30
 
31
- In a Rails app, you can add a gem dependency in environment.rb:
31
+ In a Rails 2.x app, you can add a gem dependency in environment.rb:
32
32
 
33
- config.gem "spatial_adapter"
33
+ config.gem 'spatial_adapter'
34
+
35
+ In a Rails 3 app, add a gem dependency to Gemfile:
36
+
37
+ gem 'spatial_adapter'
34
38
 
35
39
  === As a Rails Plugin
36
40
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.1.1
1
+ 1.1.2
@@ -99,7 +99,7 @@ ActiveRecord::ConnectionAdapters::PostgreSQLAdapter.class_eval do
99
99
  columns(table_name).each do |col|
100
100
  if column_names.include?(col.name.to_sym)
101
101
  # Geometry columns have to be removed using DropGeometryColumn
102
- if col.spatial? && !col.geographic?
102
+ if col.is_a?(SpatialColumn) && col.spatial? && !col.geographic?
103
103
  execute "SELECT DropGeometryColumn('#{table_name}','#{col.name}')"
104
104
  else
105
105
  original_remove_column(table_name, col.name)
data/rails/init.rb CHANGED
@@ -1,4 +1,4 @@
1
- # Rails initialization
1
+ # Rails initialization (for Rails 2.x)
2
2
  #
3
3
  # This will load the adapter for the currently used database configuration, if
4
4
  # it exists.
@@ -330,22 +330,36 @@ describe "Spatially-enabled Migrations" do
330
330
  end
331
331
  end
332
332
 
333
+ SpatialAdapter.geometry_data_types.keys.each do |type|
334
+ it "should remove #{type.to_s} geography columns using ALTER TABLE DROP COLUMN" do
335
+ ActiveRecord::Schema.define do
336
+ create_table :migrated_geometry_models, :force => true do |t|
337
+ t.integer :extra
338
+ t.send(type, :geom, :geographic => true)
339
+ end
340
+ end
333
341
 
334
- SpatialAdapter.geometry_data_types.keys.each do |type|
335
- it "should remove #{type.to_s} geography columns using ALTER TABLE DROP COLUMN" do
342
+ @connection.should_receive(:execute).with(/alter table.*migrated_geometry_models.*drop.*geom/i)
343
+ ActiveRecord::Schema.define do
344
+ remove_column :migrated_geometry_models, :geom
345
+ end
346
+ @connection.should_receive(:execute).with(anything())
347
+ end
348
+ end
349
+
350
+ it "should still remove non-spatial columns using ALTER TABLE DROP COLUMN" do
336
351
  ActiveRecord::Schema.define do
337
352
  create_table :migrated_geometry_models, :force => true do |t|
338
353
  t.integer :extra
339
- t.send(type, :geom, :geographic => true)
354
+ t.point :geom
340
355
  end
341
356
  end
342
357
 
343
- @connection.should_receive(:execute).with(/alter table.*migrated_geometry_models.*drop.*geom/i)
358
+ @connection.should_receive(:execute).with(/alter table.*migrated_geometry_models.*drop.*extra/i)
344
359
  ActiveRecord::Schema.define do
345
- remove_column :migrated_geometry_models, :geom
360
+ remove_column :migrated_geometry_models, :extra
346
361
  end
347
362
  @connection.should_receive(:execute).with(anything())
348
363
  end
349
364
  end
350
- end
351
365
  end
metadata CHANGED
@@ -5,11 +5,12 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 1
8
- - 1
9
- version: 1.1.1
8
+ - 2
9
+ version: 1.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Pete Deffendol
13
+ - Guilhem Vellut
13
14
  autorequire:
14
15
  bindir: bin
15
16
  cert_chain: []