We're currently building an application that has a Keyword model, with
a :text property that stores the text of the keyword (class
declaration below).  The :text property needs to be case sensitive, so
a :text of "Polish" and "polish" would be considered two different
records.

In our dev environment we had been using SQLite, which is case-
sensitive, and thus putting :unique => true was getting us what we
wanted - enforced uniqueness at the data store level and the ability
to look up records by the :text property in a case-sensitive way.

Just this week we've moved in to our QA/Staging environment which runs
MySQL, and have run in to the issue where the String type by default
creates a column as VARCHAR, which is not case sensitive, and we
received errors when trying to INSERT rows with "polish" when "Polish"
already existed.

At this point we're looking for suggestions on what's the best course
of action?  Should we make our own type to plug in to Datamapper that
handles case-sensitive strings?  Maybe handle the case-sensitivity
programmatically in our model code?  Other?

And for reference, here is our model...

class Keyword
  include DataMapper::Resource

  # Property definitions
  property :id, Serial
  property :text, String, :length => 255
  timestamps :at

end
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DataMapper" group.
To post to this group, send email to datamapper@googlegroups.com
To unsubscribe from this group, send email to 
datamapper+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to