#930 ✓resolved

Type Json fails to migrate.

Reported by ojak | June 29th, 2009 @ 02:56 AM | in 0.10.2

Json type fails migration with the following error:

 ~ Column length too big for column 'data' (max = 21845); use BLOB or TEXT instead (code: 1074, sql state: 42000, query: CREATE TABLE "temp_payments" ("session_id" VARCHAR(32) NOT NULL, "data" VARCHAR(65535), "created_at" DATETIME NOT NULL, "updated_at" DATETIME NOT NULL, PRIMARY KEY("session_id")) ENGINE = InnoDB CHARACTER SET utf8 COLLATE utf8_general_ci, uri: mysql://root@localhostcyr_dev?socket=/tmp/mysql.sock)
rake aborted!
Column length too big for column 'data' (max = 21845); use BLOB or TEXT instead
/opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/migrations.rb:151:in execute_non_query'
/opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/adapters/data_objects_adapter.rb:263:in with_connection'
/opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/migrations.rb:669:in create_model_storage'
/opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/migrations.rb:51:in send'

Sample model:

class Book
  property :json_data, Json

Tried this patch, but it DID NOT WORK.

# dm-types-0.10.0/lib/dm-types/json.rb

module DataMapper module Types

class Json < DataMapper::Types::Text
  #primitive String
  #length    65535
  #lazy      true


Attempted patch resulted in:

+type+ was DataMapper::Types::Json, which is not a supported type
/opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/property.rb:815:in initialize'
/opt/local/lib/ruby/gems/1.8/gems/dm-core-0.10.0/lib/dm-core/model/property.rb:55:in property'</code>

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