#1044 ✓resolved
Sindre Aarsaether

Auto-migrate failing with json/yaml fields + quick fix

Reported by Sindre Aarsaether | September 17th, 2009 @ 01:30 PM

This has bothered me for a while now, and the fix is very simple. When trying to auto-migrate a model with json or yaml-fields (from dm-types) it throws an error..

Column length too big for column 'mycolumnname' (max = 21845); use BLOB or TEXT instead

Fix is simple:


diff --git a/dm-types/lib/dm-types/json.rb b/dm-types/lib/dm-types/json.rb
index 2a5ba3f..75ddc53 100644
--- a/dm-types/lib/dm-types/json.rb
+++ b/dm-types/lib/dm-types/json.rb
@@ -4,7 +4,7 @@ module DataMapper
   module Types
     class Json < DataMapper::Type
       primitive String
-      length    65535
+      size      65535
       lazy      true
 
       def self.load(value, property)
diff --git a/dm-types/lib/dm-types/yaml.rb b/dm-types/lib/dm-types/yaml.rb
index f44c4c7..971f18b 100644
--- a/dm-types/lib/dm-types/yaml.rb
+++ b/dm-types/lib/dm-types/yaml.rb
@@ -4,7 +4,7 @@ module DataMapper
   module Types
     class Yaml < DataMapper::Type
       primitive String
-      length    65535
+      size      65535
       lazy      true
 
       def self.load(value, property)

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

People watching this ticket

Pages