#1181 ✓resolved

[migration_runner] In uninitialized constant Text (NameError)

Reported by DAddYE | January 14th, 2010 @ 04:40 AM

Hi to all,

I have a problem running migrations. Columns that have TEXT type give me an error.

For reproduce the problem try this:

require 'rubygems'
require 'dm-core'
require 'dm-migrations/migration_runner'

DataMapper.setup(:default, "sqlite3::memory")

DataMapper::Logger.new(STDOUT, :debug)
DataMapper.logger.debug( "Starting Migration" )

migration 1, :create_people_table do
  up do
    create_table :people do
      column :id,   Integer, :serial => true
      column :name, String, :size => 50
      column :age,  Integer
      column :foo,  Text
  down do
    drop_table :people

if $0 == __FILE__
  if $*.first == "down"

My output is:

$ ruby sample_migration.rb 
 ~ Starting Migration
 == Performing Up Migration #7: create_people_table
sample_migration.rb:16: uninitialized constant Text (NameError)

from /Library/Ruby/Gems/1.8/gems/dm-migrations-0.10.2/lib/dm-migrations/sql/table_creator.rb:12:in `instance_eval'
from /Library/Ruby/Gems/1.8/gems/dm-migrations-0.10.2/lib/dm-migrations/sql/table_creator.rb:12:in `initialize'
from /Library/Ruby/Gems/1.8/gems/dm-migrations-0.10.2/lib/dm-migrations/migration.rb:88:in `new'
from /Library/Ruby/Gems/1.8/gems/dm-migrations-0.10.2/lib/dm-migrations/migration.rb:88:in `create_table'
from sample_migration.rb:12
from /Library/Ruby/Gems/1.8/gems/dm-migrations-0.10.2/lib/dm-migrations/migration.rb:57:in `call'
from /Library/Ruby/Gems/1.8/gems/dm-migrations-0.10.2/lib/dm-migrations/migration.rb:57:in `perform_up'
from /Library/Ruby/Gems/1.8/gems/dm-migrations-0.10.2/lib/dm-migrations/migration.rb:136:in `say_with_time'
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
from /Library/Ruby/Gems/1.8/gems/dm-migrations-0.10.2/lib/dm-migrations/migration.rb:136:in `say_with_time'
from /Library/Ruby/Gems/1.8/gems/dm-migrations-0.10.2/lib/dm-migrations/migration.rb:56:in `perform_up'
from /Library/Ruby/Gems/1.8/gems/dm-migrations-0.10.2/lib/dm-migrations/migration_runner.rb:57:in `migrate_up!'
from /Library/Ruby/Gems/1.8/gems/dm-migrations-0.10.2/lib/dm-migrations/migration_runner.rb:55:in `each'
from /Library/Ruby/Gems/1.8/gems/dm-migrations-0.10.2/lib/dm-migrations/migration_runner.rb:55:in `migrate_up!'
from sample_migration.rb:45</code>

Comments and changes to this ticket

  • Akzhan

    Akzhan March 18th, 2010 @ 11:28 AM



    column :foo,  Text


    column :foo,  "TEXT"
  • DAddYE

    DAddYE March 31st, 2010 @ 05:53 PM

    Thanks Akzhan,

    but I want know if this bug is accepted will be fixed or ... ?

  • DAddYE

    DAddYE April 13th, 2010 @ 05:13 PM

    • Assigned user set to “Dan Kubb (dkubb)”

    Hey guys one question but this problems persist also in dm-migrations or dm-rails? There is any fix in planning?


  • Dan Kubb (dkubb)

    Dan Kubb (dkubb) April 13th, 2010 @ 08:27 PM

    • State changed from “new” to “unconfirmed”
    • Assigned user cleared.

    Yes, this will be fixed, but not before other higher priority tickets are resolved first. There are ~160 tickets, and it takes alot of time to just to verify each of them. Fixing a bug can sometimes take a few hours to a few days, so I can usually only resolve a few each week.

    It's likely that dm-migrations will be refactored to resolve some older tickets, and deal with some other problems internally, so this will probably be rolled into those fixes rather than tackled individually.

    If you're interested in taking on refactoring dm-migrations please let me know, otherwise it is likely this won't be in the queue until after DataMapper 1.0 is released.

    NOTE: We don't put anyone as "responsible" unless they are actively working on the ticket and expect some sort of resolution within the next week or so. Removing myself from responsibility for this ticket for now.

  • Martin Gamsjaeger (snusnu)

    Martin Gamsjaeger (snusnu) April 15th, 2010 @ 11:24 AM

    • State changed from “unconfirmed” to “confirmed”


    Another workaround is to scope the various datamapper types properly. Try DataMapper::Types::Text instead of just Text for the time being. See http://is.gd/bu8U3

  • DAddYE

    DAddYE April 19th, 2010 @ 05:30 PM

    Thanks so much Martin, I think your way for now it's a good alternative.


  • Piotr Solnica (solnic)

    Piotr Solnica (solnic) March 24th, 2011 @ 06:58 AM

    • State changed from “confirmed” to “resolved”
    • Milestone order changed from “0” to “0”

    This is fixed in recent DM 1.1.0

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 »