[Georuby-devel] SpatialAdapter Migrations: Providing an option to not use AddGeometryColumn?

Leo Soto M. leo.soto at gmail.com
Mon May 19 11:57:45 EDT 2008

On Sat, May 17, 2008 at 9:38 AM, Guilhem Vellut
<guilhem.vellut at gmail.com> wrote:
> Hello,
> Thanks for the patch for 1.2.x (it was from some time ago...). I just
> committed it.

Thanks *you*. GeoRuby and the Spatial Adapter looks like a great piece
of software.


> The better thing would be a modification to the code
> adding a column, in order to have an option to indicate the user
> doesn't want to add a column through select AddGeometriColumn(...) but
> use the usual standard rails way.


> By a quick look at the spatial
> adapter, adding some processing to the
> PostgreSQLTableDefinition#column method and the
> PostgreSQLColumnDefintiion class should be enough.

I managed to do it without modifying PostgreSQLColumnDefintion, but
that was because I modified
ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#add_column. I
don't know too much about ActiveRecord, so that may be a wrong way to
do it.

I also think that remove_column should be patched in a similar way.

> I will try to add
> that in the coming days (probably end of next week) but if you have a
> patch before then, i will include it.

I'd happy to write it. I'm just uncertain of the name of the option to
keep the "old way" to create the column. Here are some options:

t.column :foo, :geometry, :enforce_srid => false
t.column :foo, :geometry, :create_using_addgeometrycolumn => false
t.column :foo, :geometry, :opengis => false

I don't like the first, because it is misleading: what I'm
implementing doesn't only removes the enforcement of srid; it also
ignores dimensions, and doesn't register the column on the
geometry_column table.

The second one is very tied to the implementation and a bit large, but
very clear. The third tries to be more concise, but may raise
questions to people looking at the code.

So I'm leaning towards the second option (even after using the third
one when I prototyped it). But you have the last word on it.
Leo Soto M.

More information about the Georuby-devel mailing list