On Dec 28, 6:44 pm, Iñaki Baz Castillo <[email protected]> wrote: > Hi, I'm building a migration and need a MEDIUMBLOB column in case of MySQL or > BYTEA in case of Postgres. > > BYTEA has no size contrains while MySQL's BLOB is limited to 64k so I need > MEDIUMBLOB. > > AFAIK the only way to generate such column is: > > column :doc, File > > This generates BYTEA for Postgres, but it generates BLOB for MySQL. > I've also tryed: > > column :doc, File, :size => 999999999 > > with same result. > > The only workaround I can imagine is using a "if" stament to inspect the > database schema and use: > > case schema > when :mysql > mediumblob :doc > when :posgres > bytea :doc > end > > but I would really avoid such workaround. Is there a way to achieve what I > want?
Currently, the conditional is the only way to do it. I'd consider a patch to the MySQL adapter that respected a :size option for the generic File type that is recognized (i.e. File :doc, :size=>:medium). The way Sequel is set up, it doesn't complain if you pass unregonized options, so the option would just be ignored on other database adapters. Jeremy -- You received this message because you are subscribed to the Google Groups "sequel-talk" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sequel-talk?hl=en.
