I have followed the tutorial at http://godbit.com/article/beginners-guide-to-rails-part-1 to learn rake migrate. I created a database and have the database information in my database.yml correct. I ran ruby to generate migrate for table and in the ruby code I added the following class ContactDB < ActiveRecord::Migration --- was already there def self.up --- was already create_table "people" do |t| t.column "id", :integer t.column "name", :string end end def self.down drop_table :people end end when I ran 'rake migrate' I get an error like the following == ContactDb: migrating ========================== --- create_table("people") rake aborted MySql::Error: #420000You 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 people ('id' int(11) DEFAULT NULL auto_increment PRIMARY KEY(11), 'name' varchar(255) DEFAULT NULL) ENGINE=InnoDB (See full trace by running task with --trace) Could some one tell me what am I doing wrong? Thanks.
on 2007-06-12 22:59
on 2007-06-12 23:06
DBC User wrote: > create_table "people" do |t| > when I ran 'rake migrate' I get an error like the following > > (See full trace by running task with --trace) > > Could some one tell me what am I doing wrong? > > Thanks. > Rails automatically adds the "id" field. You do not need to (must not) include that in your schema. I don't think there are any other errors, but I'm sleepy :-D Cheers Mohit.
on 2007-06-12 23:12
On Jun 12, 2:04 pm, Mohit S. <email@example.com> wrote: > > already > > > ENGINE=InnoDB > I don't think there are any other errors, but I'm sleepy :-D > > Cheers > Mohit.- Hide quoted text - > > - Show quoted text - Thank you so much, it worked. Now I remember, in the begining when I using MySql I ran into the same problem. Thanks again.