On Thursday, October 9, 2014 10:16:53 AM UTC-7, Wesley Staples wrote:
>
> I have a mysql table that when dumped looks like:
>
> create_table(:test_table) do
>     String :item_name, :size=>10, :fixed=>true, :null=>false
>     BigDecimal :amount, :default=>BigDecimal.new("0.0"), :size=>[17, 4], 
> :null=>false
>     String :yes_no, :size=>3, :null=>false, :default=>"YES"
> end
>
> The issue is the column "item_name" has a default value of '' (an empty 
> string).
>
> When I use the dumped code to migrate a sqlite table I'm having difficulty 
> inserting records because it believes the default value is null and nulls 
> are not allowed. I have tried sequel with both the upper and lowercase d 
> neither will dump a default value of an empty string.
>
> What can I do to get sequel to include a default value even for empty 
> strings?
>

The reason for this is that Sequel's current schema parser on MySQL doesn't 
differentiate between NULL and and empty string.  This appears to be by 
design, as there is specific code that sets the default to nil if it is an 
empty string, but it may have only been necessary in older versions.  I'll 
do some testing and if nothing breaks, I'll commit a fix.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.

Reply via email to