# Newbee rake migrate question

**URL:** <https://www.ruby-forum.com/t/newbee-rake-migrate-question/58281>\
**Category:** Rails\
**Created:** [April 20, 2006, 8:20am UTC](https://www.ruby-forum.com/t/newbee-rake-migrate-question/58281 "2006-04-20T08:20:45Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![leemhenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b4bc9f/32.png) [@leemhenson](https://www.ruby-forum.com/u/leemhenson)\
**Post date:** [April 20, 2006, 8:20am UTC](https://www.ruby-forum.com/t/newbee-rake-migrate-question/58281/1 "2006-04-20T08:20:45Z")

</div>

with a simple table def.

class Objects \< ActiveRecord::Migration  
def self.up  
create\_table :objects do |table|  
table.column :name, string  
end

def self.down  
drop\_table :objects  
end  
end

when I run rake migrate, I get:

\*\* Invoke migrate (first\_time)  
\*\* Invoke db:migrate (first\_time)  
\*\* Invoke environment (first\_time)  
\*\* Execute environment  
\*\* Execute db:migrate  
rake aborted!  
./db/migrate//001\_objects.rb:10: parse error, unexpected $, expecting  
kEND  
/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active\_support/dependencies.rb:140:in  
`load' /usr/local/lib/ruby/gems/1.8/gems/activesupport-1.3.1/lib/active_support/dependencies.rb:140:in`load’  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/migration.rb:340:in  
`migration_classes' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/connection_adapters/mysql_adapter.rb:190:in`inject’  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/migration.rb:339:in  
`migration_classes' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:327:in`migrate’  
/usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active\_record/migration.rb:294:in  
`up' /usr/local/lib/ruby/gems/1.8/gems/activerecord-1.14.2/lib/active_record/migration.rb:285:in`migrate’  
/usr/local/lib/ruby/gems/1.8/gems/rails-1.1.2/lib/tasks/databases.rake:4  
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in  
`execute' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:387:in`execute’  
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:357:in `invoke' /usr/local/lib/ruby/1.8/thread.rb:135:in`synchronize’  
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:364:in`invoke\_prerequisites’  
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:999:in `each' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:363:in`invoke\_prerequisites’  
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:356:in `invoke' /usr/local/lib/ruby/1.8/thread.rb:135:in`synchronize’  
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:350:in `invoke' /usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in`run’  
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/lib/rake.rb:1906:in `run’  
/usr/local/lib/ruby/gems/1.8/gems/rake-0.7.1/bin/rake:7  
/usr/local/bin/rake:18

from terminal

and

e[4;36;1mSQL (0.031305)e[0m e[0;1mCREATE TABLE schema\_info  
(version int(11))e[0m  
e[4;35;1mSQL (0.004014)e[0m e[0mINSERT INTO schema\_info (version)  
VALUES(0)e[0m  
e[4;36;1mSQL (0.000000)e[0m e[0;1mMysql::Error: Table  
‘schema\_info’ already exists: CREATE TABLE schema\_info (version  
int(11))e[0m  
e[4;36;1mSQL (0.000000)e[0m e[0;1mMysql::Error: Table  
‘schema\_info’ already exists: CREATE TABLE schema\_info (version  
int(11))e[0m  
e[4;35;1mSQL (0.000000)e[0m e[0mMysql::Error: Table ‘schema\_info’  
already exists: CREATE TABLE schema\_info (version int(11))e[0m

in the log.

(of course schema\_info didn’t exist until I ran rake.)

I’ve googled this quite a bit and see people talking about ruby 1.8.4  
breaking things, but I don’t find a specific comment about the model  
making.

Any directions?

Thanks, in advance.

---

<div class="post-metadata">

**Author:** ![leemhenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b4bc9f/32.png) [@leemhenson](https://www.ruby-forum.com/u/leemhenson)\
**Post date:** [April 20, 2006, 9:18am UTC](https://www.ruby-forum.com/t/newbee-rake-migrate-question/58281/2 "2006-04-20T09:18:01Z")

</div>

Lee H. wrote:

> with a simple table def.
> 
> class Objects \< ActiveRecord::Migration  
> def self.up  
> create\_table :objects do |table|  
> table.column :name, string  
> end

I think your problem is here, you haven’t ended the “do” block.

Add another end, after you add the column.

David

---

<div class="post-metadata">

**Author:** ![leemhenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b4bc9f/32.png) [@leemhenson](https://www.ruby-forum.com/u/leemhenson)\
**Post date:** [April 20, 2006, 3:39pm UTC](https://www.ruby-forum.com/t/newbee-rake-migrate-question/58281/3 "2006-04-20T15:39:00Z")

</div>

On 4/20/06, David [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Add another end, after you add the column.
> 
> David

Thank you. That got me further and I’ll look around before I ask about  
the next error message.

–  
Tech support: Click on the ‘my computer’ icon on to the left of the  
screen.  
Customer: Your left or my left?

---

<div class="post-metadata">

**Author:** ![leemhenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b4bc9f/32.png) [@leemhenson](https://www.ruby-forum.com/u/leemhenson)\
**Post date:** [April 20, 2006, 10:41pm UTC](https://www.ruby-forum.com/t/newbee-rake-migrate-question/58281/4 "2006-04-20T22:41:49Z")

</div>

Lee :

> > > > class Objects \< ActiveRecord::Migration  
> > > > def self.up  
> > > > create\_table :objects do |table|  
> > > > table.column :name, string  
> > > > end

> > Thank you. That got me further and I’ll look around before  
> > I ask about the next error message.

Be careful, Object is a reserved word.

[http://ruby-doc.org/core/classes/Object.html](http://ruby-doc.org/core/classes/Object.html)

– Jean-FranÃ§ois.

---

<div class="post-metadata">

**Author:** ![leemhenson](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/b4bc9f/32.png) [@leemhenson](https://www.ruby-forum.com/u/leemhenson)\
**Post date:** [April 20, 2006, 3:42pm UTC](https://www.ruby-forum.com/t/newbee-rake-migrate-question/58281/5 "2006-04-20T15:42:09Z")

</div>

On 4/20/06, Lee H. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > I think your problem is here, you haven’t ended the “do” block.
> > 
> > Add another end, after you add the column.
> > 
> > David
> 
> Thank you. That got me further and I’ll look around before I ask about  
> the next error message.

A missing colon, and I’m good to go.

Thanks again.

–  
Tech support: Click on the ‘my computer’ icon on to the left of the  
screen.  
Customer: Your left or my left?
