On Aug 31, 12:20 pm, None <[email protected]> wrote: > I have a db table that dumps to this: > > Class.new(Sequel::Migration) do > def up > create_table(:foo) do > primary_key :someId > column :fk, "int(11)", :null=>false > column :other_fk, "int(11)", :null=>false > column :type, "enum > ('parent','child')", :default=>"parent".lit, :null=>false > end > def down > ... > end > end > > However, the ".lit" on the enum column chokes running the migration. > Anyone solved this yet? > > Using sequel 3.0.0, mysql 5.0.82.
There's two ways to handle this: 1) Convert unparseable column defaults to nil, instead of using the .lit hack (which apparently doesn't work most of the time for MySQL). 2) Handle the enum type in column_schema_to_ruby_default. Option 1 is more reliable in terms of not producing broken migrations, but would also drop defaults that are specified in the database. Option 2 should make things work, at the cost of some bloat. Both options can be used at the same time. I'm leaning toward doing both. It's probably too late to do this for 3.4.0, but I've added it to my todo list, so it should be fixed after the release of 3.4.0. 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 -~----------~----~----~----~------~----~------~--~---
