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?