SchemaPlus / schema_plus

SchemaPlus provides a collection of enhancements and extensions to ActiveRecord
Other
680 stars 84 forks source link

Can't dump tables with GIS types in MySQL #124

Open ghost opened 11 years ago

ghost commented 11 years ago

I'm using MySQL and have a table with a MULTIPOLYGON type. It seems like schema_plus can't dump the table definition as it has no knowledge of the types to use, though I'm not sure.

Perhaps support for dazuma/rgeo or dazuma/activerecord-mysql2spatial-adapter would work?

ghost commented 11 years ago

A bit of digging has given me a bit more understanding about why this doesn't work:

The ActiveRecord SchemaDumper class does a lookup for the applicable types here, which checks in this hash for valid types.

So I think a number of things would have to be done to get this working. The activerecord-mysql2spatial-adapter's MainAdapter's class would have to somehow inform the SchemaDumper of the new types. There would also have to be some work done in schema_plus to support the Mysql2SpatialAdapter, perhaps delegating mostly to the existing Mysql2Adapter, but with specific logic dealing with the :spatial types.

Not sure how it would all fit together though, especially since the activerecord-mysql2spatial-adapter doesn't even support Rails 4 right now.