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
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.
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