Feature. String#lit overrides string literalization - i.e. use lit if you do not want quotes around your string in generated sql. In your case you do want the quotes, so do not use lit.
See rdoc for String#lit - it explains it best. On May 21, 2009, at 11:45 AM, None <[email protected]> wrote: > > This: > > Class.new(Sequel::Migration) do > def up > create_table(:groups) do > primary_key :groupID > String :groupPhoto > String :groupApprovalType, :default=>"manager".lit, :null=>false > String :groupManagerEmail > end > > etc etc > > > Is the result of DB.dump_schema_migration (courtesy of require > 'sequel/ > extensions/schema_dumper'). However mysql doesn't like it: > > CREATE TABLE `groups` (`groupID` integer PRIMARY KEY AUTO_INCREMENT, > `groupPhoto` varchar(255), `groupApprovalType` varchar(255) NOT NULL > DEFAULT manager, `groupManagerEmail` varchar(255)) > rake aborted! > Mysql::Error You have an error in your SQL syntax; check the manual > that corresponds to your MySQL server version for the right syntax to > use near 'manager, `groupManagerEmail` varchar(255))' at line 1 > > Removing the ".lit" on the :default works; the generated SQL is: > > CREATE TABLE `groups` (`groupID` integer PRIMARY KEY AUTO_INCREMENT, > `groupPhoto` varchar(255), `groupApprovalType` varchar(255) NOT NULL > DEFAULT 'manager', `groupManagerEmail` varchar(255)) > > > Bug? Or feature? > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
