My db:migrate code as generated by ROR refuses to run. I’m running MySQL
as the db, and think I have everything installed and configured
correctly. I’ve tried deletion of the colon, quoting with single and
double quotes, and nothing seems to work, I just keep getting different
syntax errors. I’m new to ROR, but had a similar version working on a
different machine with a Debian install, and this is on gOS, an Ubuntu
derivative (it pretty much sucks(give me something that isn’t broken by
design.)) Code and a trace are copied below. Does anybody know how to
solve this?
001_create_cars.rb:
class CreateCars < ActiveRecord::Migration
def self.up
create_table :cars do |t|
t.varchar(64) :Title
t.varchar(255) :Img
t.varchar(64) :Maker
t.varchar(64) :Year
t.text :Desc
t.varchar(64) :Price
t.boolean :Show
t.boolean :Sold
t.timestamps : ID
end
end
def self.down
drop_table :cars
end
end
rake db:migrate --trace
(in /usr/local/aptana/workspace/CarSales)
rake db:migrate
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
./db/migrate//001_create_cars.rb:4: syntax error, unexpected ‘:’,
expecting kEND
t.varchar(64) :Title
^
./db/migrate//001_create_cars.rb:5: syntax error, unexpected ‘:’,
expecting kEND
t.varchar(255) :Img
^
./db/migrate//001_create_cars.rb:6: syntax error, unexpected ‘:’,
expecting kEND
t.varchar(64) :Maker
^
./db/migrate//001_create_cars.rb:7: syntax error, unexpected ‘:’,
expecting kEND
t.varchar(64) :Year
^
./db/migrate//001_create_cars.rb:9: syntax error, unexpected ‘:’,
expecting kEND
t.varchar(64) :Price
^
/var/lib/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
load' /var/lib/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
load’
/var/lib/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:342:in
new_constants_in' /var/lib/gems/1.8/gems/activesupport-2.0.2/lib/active_support/dependencies.rb:489:in
load’
/var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:360:in
migration_classes' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/connection_adapters/mysql_adapter.rb:286:in
inject’
/var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:359:in
each' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:359:in
inject’
/var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:359:in
migration_classes' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:339:in
migrate’
/var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:307:in
up' /var/lib/gems/1.8/gems/activerecord-2.0.2/lib/active_record/migration.rb:298:in
migrate’
/var/lib/gems/1.8/gems/rails-2.0.2/lib/tasks/databases.rake:85
/usr/lib/ruby/1.8/rake.rb:387:incall' /usr/lib/ruby/1.8/rake.rb:387:in
execute’
/usr/lib/ruby/1.8/rake.rb:387:ineach' /usr/lib/ruby/1.8/rake.rb:387:in
execute’
/usr/lib/ruby/1.8/rake.rb:357:ininvoke' /usr/lib/ruby/1.8/rake.rb:350:in
synchronize’
/usr/lib/ruby/1.8/rake.rb:350:ininvoke' /usr/lib/ruby/1.8/rake.rb:1924:in
run’
/usr/lib/ruby/1.8/rake.rb:1924:ineach' /usr/lib/ruby/1.8/rake.rb:1924:in
run’
/usr/bin/rake:4