MySql set(...) data type support added #529

merged 0 commits into from Aug 3, 2012


None yet
2 participants

Slike9 commented Aug 3, 2012

In MySql values of "set(...)" data type loose default values.


jeremyevans commented Aug 3, 2012

This looks simple enough, but from the MySQL documentation, set is not the same as the enum type, it can have multiple values. A cleaner fix would probably be to override it in the MySQL adapter since it is a MySQL-specific type (and refactor column_schema_to_ruby_default), but if you don't want to do that, just returning :set for the set type and adding :set next to :enum in column_schema_to_ruby_default seems like a better way to handle this.

@Slike9 Slike9 merged commit 8c3ac0e into jeremyevans:master Aug 3, 2012


jeremyevans commented Aug 3, 2012

I've decided to fix this and do some refactoring of the related code. I'm currently testing this, it should hopefully be up shortly.


jeremyevans commented Aug 3, 2012

Not sure what's going on with GitHub, as Slike9 doesn't have permission to merge into jeremyevans:master, and it doesn't look like the merge was actually applied to the repository.

jeremyevans added a commit that referenced this pull request Aug 3, 2012

Recognize MySQL set type and default value (Fixes #529)
While here, refactor column_schema_to_ruby_default to not check
for database types.  Instead, override the method and call
super inside the shared adapters.

Instead of supporting set for all databases, only add it to the
shared mysql adapter.  Likewise, since interval is only supported
on PostgreSQL, move support for it to the shared postgres adapter.

For simplicity, still recognize the :set and :interval type symbols
in the global code in order to return the default values as a ruby
string, though that may be refactored out to the adapters later.

While here, do some minor cleaning up of the postgres adapter specs.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment