Hello, I’m new to rails and I’m trying to get a tutorial application
off the ground
when running rake migrate it errors with a mysql syntax error
response:
Mysql::Error: You 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, address
varchar(255) DEFAULT NULL, ci' at line 1: CREATE TABLE people (
idint(11) DEFAULT NULL auto_increment PRIMARY KEY(11),
namevarchar(255) DEFAULT NULL,
addressvarchar(255) DEFAULT NULL,
cityvarchar(255) DEFAULT NULL,
statevarchar(255) DEFAULT NULL,
zipcode` varchar(255) DEFAULT NULL) ENGINE=InnoDB
My db file is as follows:
class ContactDb < ActiveRecord::Migration
def self.up
create_table “people” do |t|
t.column “id”, :integer
t.column “name”, :string
t.column “address”, :string
t.column “city”, :string
t.column “state”, :string
t.column “zipcode”, :string
end
end
def self.down
drop_table :people
end
end
I’m using a default mysql, apache, ruby, rails etc. install.
I noticed that It set the value of PRIMAY KEY to 11 and thought that
was kind of strange.
Anybody got any suggestions to get rake working right?
Thanks,
Donald