Rake Migrate Syntax Error

When in Terminal on Mac OS X, I get this syntax error when I run the
“rake migrate” command:

rake migrate --trace
(in /Users/dillon/Documents/rails/expenses/expenses)
** Invoke migrate (first_time)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
rake aborted!
./db/migrate//001_accounts.rb:1: syntax error, unexpected ‘:’, expecting
‘\n’ or ‘;’
endndrop_table :accountset, :floatle|ion
^
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:in
load' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:inload’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:342:in
new_constants_in' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:488:inload’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:343:in
migration_classes' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/mysql_adapter.rb:248:ininject’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:342:in
each' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:342:ininject’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:342:in
migration_classes' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:330:inmigrate’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:297:in
up' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/migration.rb:288:inmigrate’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/tasks/databases.rake:4
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in
call' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:inexecute’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:in
each' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:399:inexecute’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:369:in
invoke' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:insynchronize’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in
invoke' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:376:ininvoke_prerequisites’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1021:in
each' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1021:insend’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1021:in
each' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:375:ininvoke_prerequisites’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:368:in
invoke' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:insynchronize’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:362:in
invoke' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1935:inrun’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1935:in
each' /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/lib/rake.rb:1935:inrun’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rake-0.7.2/bin/rake:7
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/bin/rake:16:in
`load’
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/bin/rake:16


I’m following this tutorial:

Apparently I’m running Ruby 1.8.6 and the tutorial was made for Ruby
1.8.4.

Can anyone help me figure out how to fix it? The problem comes in the
expenses/db/migrate/001_accounts.rb

I can’t get it to post the tables to the development database I have on
mySQL.

Dillon Decicio wrote:

./db/migrate//001_accounts.rb:1: syntax error, unexpected ‘:’, expecting
‘\n’ or ‘;’
endndrop_table :accountset, :floatle|ion
^

There appears to be an error in your migration file. It seems like you
have an extra colon, perhaps at the end of a line, but without seeing
the migration contents it’s difficult to say for sure…

Mark B. wrote:

Dillon Decicio wrote:

./db/migrate//001_accounts.rb:1: syntax error, unexpected ‘:’, expecting
‘\n’ or ‘;’
endndrop_table :accountset, :floatle|ion
^

There appears to be an error in your migration file. It seems like you
have an extra colon, perhaps at the end of a line, but without seeing
the migration contents it’s difficult to say for sure…

Here’s the file:


class Accounts < ActiveRecord::Migration

def self.up
create_table :accounts do |table|
table.column :name, :string
table.column :budget, :float
end
end

def self.down
drop_table :accounts
end
end


Sorry, I’m new to Ruby on Rails. I just wanted to follow the tutorial to
see what I could learn. I figured it was a syntax error like this, but
since I don’t know the syntax… I’m not sure.

Maybe you could supply an explanation too? If not, at least show what I
did wrong.

Thanks for your prompt response.

How would you fix that lf/cr issue? Since, I’m not sure what it is based
off of just following a tutorial and not experience.

Hey, that could be because of lf/cr issues.

Julian

Well I can’t see anything wrong with the syntax of your migration, so
I’m kind of clutching at straws.

You’re using OS/X, so if you’re also using TextMate, you shouldn’t
have any issues. I’d say the other part of your code would be causing
issues too if it really were an lf/cr issue.

It’s an odd issue!

Julian.

The issue turned out to be in the config file database.yml.

I fixed that, and now it’s telling my database on MySQL isn’t set up.

I have a database for this application…

But for some reason it still says the command won’t work. Do you know
any reason that might occur?

Alright… Now I’ve tried re-installing Locomotive, and creating an
entirely new rails application.

This was the output when I followed the instructions over:


DDComp:~/new dillon$ script/generate migration accounts
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:204:in
establish_connection': development database is not configured (ActiveRecord::AdapterNotSpecified) from /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract/connection_specification.rb:195:inestablish_connection’
from
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:229:in
initialize_database' from /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:88:inprocess’
from
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:43:in
send' from /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/initializer.rb:43:inrun’
from ./script/…/config/…/config/environment.rb:13
from
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' from /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
from
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/gems/1.8/gems/rails-1.2.3/lib/commands/generate.rb:1
from
/Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
gem_original_require' from /Applications/Locomotive2/Bundles/standardRailsMar2007.locobundle/i386/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
from script/generate:3


This was for trying to generate the migration file.

The other thing worth noting, was that I could not use port 3000 anymore
for development.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs