Forum: Ruby on Rails newbie - Problem running unit test because of text column

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
83c468c64733d94d0e334bb02e95f8bd?d=identicon&s=25 vincent fazio (Guest)
on 2007-08-01 15:51
(Received via mailing list)
I'm new to Ruby and Rails and I'm having a problem.  I've creates a
ruby schema file defining a table containing a text column.  I am able
to migrate this table to a MySQL database with no problem.

Here is the table definition from my migration file.

    create_table "strings", :force => true do |t|
      t.column "string", :text, :null => false
    end

However, when I try to run  the Rake target to run my unit tests, I
get the following error.

  Mysql::Error: #42000BLOB/TEXT column 'string' can't have a default
value:
    CREATE TABLE strings (`id`   int(11) DEFAULT NULL auto_increment
PRIMARY KEY, `string` text
    DEFAULT '' NOT NULL) ENGINE=InnoDB

Can anone tell me what's going on here?  I can figure out how to get
the DEFAULT ''  out of the generated SQL.  Again, this does not happen
when I run migrations.  Does it use different code?
This topic is locked and can not be replied to.