Hello,
I mentioned this problem recently, and was told that there is a ticket for
it. In the meantime, you can use this monkeypatch:
# Make Yaml type use TEXT
module DataMapper
module Migrations
module DataObjectsAdapter
module ClassMethods
alias _type_map type_map
def type_map
t = _type_map.dup
t[Types::Yaml] = { :primitive => 'TEXT' }
t
end
end
end
end
end
This should be considered a temporary fix, though.
..tony..
On Thu, Oct 1, 2009 at 12:26 PM, sliu <[email protected]> wrote:
>
> dm 0.10.1
> mysql: 5.0.75-0ubuntu10.2-log (Ubuntu)
>
> given a line in a model:
> property :vars, Yaml
>
> call DataMapper.auto_migrate! will cause exception:
>
> /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.1/lib/dm-core/
> migrations.rb:147:in `execute_non_query': Column length too big for
> column 'vars' (max = 21845); use BLOB or TEXT instead
> (DataObjects::SQLError)
> from /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.1/lib/dm-
> core/migrations.rb:147:in `create_model_storage'
> from /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.1/lib/dm-
> core/adapters/data_objects_adapter.rb:266:in `with_connection'
> from /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.1/lib/dm-
> core/migrations.rb:144:in `create_model_storage'
> from /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.1/lib/dm-
> core/migrations.rb:1166:in `create_model_storage'
> from /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.1/lib/dm-
> core/migrations.rb:1260:in `auto_migrate_up!'
> from /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.1/lib/dm-
> core/migrations.rb:49:in `send'
> from /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.1/lib/dm-
> core/migrations.rb:49:in `repository_execute'
> from /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.1/lib/dm-
> core/model/descendant_set.rb:33:in `each'
> ... 8 levels...
>
>
> I looked into dm-types-0.10.1/lib/dm-types/yaml.rb, found the
> following code:
>
> module DataMapper
> module Types
> class Yaml < DataMapper::Type
> primitive String
> length 65535
> lazy true
>
> change `primitive String` to `primitive Text`, raise the following
> exception:
>
> /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.1/lib/dm-core/
> property.rb:784:in `initialize': +type+ was DataMapper::Types::Yaml,
> which is not a supported type (ArgumentError)
> from /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.1/lib/dm-
> core/model/property.rb:51:in `new'
> from /usr/local/ruby/lib/ruby/gems/1.8/gems/dm-core-0.10.1/lib/dm-
> core/model/property.rb:51:in `property'
> from /home/sliu/project/workflow/workflow/engine/execution.rb:9
> from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/
> custom_require.rb:31:in `gem_original_require'
> from /usr/local/ruby/lib/ruby/site_ruby/1.8/rubygems/
> custom_require.rb:31:in `require'
>
>
> when I change back to `primitive String` and comment out the line
> `length 65535`, it become OK.
>
> I don't know the exact reason.
> Hope someone help to indicate and fix it.
> Thanks.
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"DataMapper" 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/datamapper?hl=en
-~----------~----~----~----~------~----~------~--~---