allen
2007-Apr-09 09:31 UTC
Help! Error occurs while creating db schema for MySQL 5.0 using migration.
Hi all,
I''m creating the db schema for MySQL 5.0 using migration but run into
error. My migration file is as follows:
class CreateCustomers < ActiveRecord::Migration
def self.up
create_table :customers do |t|
t.column :id, :integer, :null => false
t.column :name, :string
end
end
def self.down
drop_table :customers
end
end
And the error information is:
== CreateCustomers: migrating
================================================-- create_table(:customers)
rake aborted!
Mysql::Error: #42000You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near ''(11), `name` varchar(255) DEFAULT NULL)
ENGINE=InnoDB'' at line 1: CREATE TABLE customers (`id` int(11) DEFAULT
NULL auto_increment PRIMARY KEY(11), `name` varchar(255) DEFAULT NULL)
ENGINE=InnoDB
I''ve never seen this error before. What''s wrong with my
migration file
or develop env? How could I solve this? Thanks a lot.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Konstantin G Tumalevich
2007-Apr-09 10:34 UTC
Re: Help! Error occurs while creating db schema for MySQL 5.0 using migration.
> class CreateCustomers < ActiveRecord::Migration > def self.up > create_table :customers do |t| > t.column :id, :integer, :null => false > t.column :name, :string > end > endid column generates automatically ;) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---