# Rake db:create fails and every other rake task

**URL:** <https://www.ruby-forum.com/t/rake-db-create-fails-and-every-other-rake-task/127700>\
**Category:** Rails\
**Created:** [January 31, 2008, 2:51pm UTC](https://www.ruby-forum.com/t/rake-db-create-fails-and-every-other-rake-task/127700 "2008-01-31T14:51:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![kaizerkaizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kaizerkaizer](https://www.ruby-forum.com/u/kaizerkaizer)\
**Post date:** [January 31, 2008, 2:51pm UTC](https://www.ruby-forum.com/t/rake-db-create-fails-and-every-other-rake-task/127700/1 "2008-01-31T14:51:57Z")

</div>

Okay, I’m trying really hard to get this to work. And it has worked  
before. I have added tables to my database before but now it suddenly  
doesn’t "know how to build task ‘db:create’, ‘db:drop’ or even  
‘db:reset’.

I’ve updated to the latest ruby gems, latest rails, but these do not  
solve the problem either.

I’ve checked the rake -T and can not locate any command called  
‘db:create’, ‘db:drop’ or even ‘db:reset’ which I though I would find  
there.

I even tried to do an ugly solution by inserting the table contents in  
the schema, but it rendered that i had an error in my SQL syntax. I  
can’t see why it would be my table that is wrong, but maybe somehow it’s  
a possibillity, or?

create\_table :portfolios, :force =\> true do |t|  
t.column “parent\_id”, :integer  
t.column “content\_type”, :string  
t.column “filename”, :string  
t.column “thumbnail”, :string  
t.column “size”, :integer  
t.column “width”, :integer  
t.column “height”, :integer  
t.column “user\_id”, :interger  
end

so i even tried to insert it manually in SQLyog, but there isn’t a  
string value to select to insert into my table.

WHAT IS WROOONG?!

---

<div class="post-metadata">

**Author:** ![kaizerkaizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kaizerkaizer](https://www.ruby-forum.com/u/kaizerkaizer)\
**Post date:** [January 31, 2008, 4:44pm UTC](https://www.ruby-forum.com/t/rake-db-create-fails-and-every-other-rake-task/127700/2 "2008-01-31T16:44:14Z")

</div>

On Jan 31, 7:51 am, Dag S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Okay, I’m trying really hard to get this to work. And it has worked  
> before. I have added tables to my database before but now it suddenly  
> doesn’t "know how to build task ‘db:create’, ‘db:drop’ or even  
> ‘db:reset’.

What version of Rails is your app using, and is Rails frozen to your  
app or is it using gems?

Are you running rake from the “root” of your application directory  
tree?

What OS are you on?

Jeff

> **[Hey Daddio!](http://softiesonrails.com)**
>
> Home of Hey Daddio Software

---

<div class="post-metadata">

**Author:** ![kaizerkaizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kaizerkaizer](https://www.ruby-forum.com/u/kaizerkaizer)\
**Post date:** [January 31, 2008, 11:05pm UTC](https://www.ruby-forum.com/t/rake-db-create-fails-and-every-other-rake-task/127700/3 "2008-01-31T23:05:06Z")

</div>

Jeff C. wrote:

> On Jan 31, 7:51ï¿½am, Dag S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> wrote:
> 
> > Okay, I’m trying really hard to get this to work. And it has worked  
> > before. I have added tables to my database before but now it suddenly  
> > doesn’t "know how to build task ‘db:create’, ‘db:drop’ or even  
> > ‘db:reset’.
> 
> What version of Rails is your app using,

Well, I ran it on “1.8.6-26 Final Release”, and everything worked until  
today when I tried to add a new table with the migrate etc. Since it  
didn’t work I assumed maybe there was some sort of new version out of  
gems or even rails, so I followed the instructions for updating my gems  
and rails  
([Ruby on Rails — Trouble installing new gems? (Part II)](http://weblog.rubyonrails.org/2007/12/19/trouble-installing-new-gems))

> and is Rails frozen to your  
> app or is it using gems?  
> frozen? I don’t think it is. Hard to say right at the moment since I’m  
> writing from home, but I’ll get back about that in 8 hours. I’m using  
> gems as far as I know, didn’t know it was possible NOT to use gems…

> Are you running rake from the “root” of your application directory  
> tree?

I’ve tried to run it from the “root” of my application, from the “db”  
directory and migrate directory. All of which rendered the same error.

> What OS are you on?

I’m running it on Windows XP

> Jeff  
> [softiesonrails.com](http://softiesonrails.com)

Thanks allot for the input, hope this makes it clearer about my problem.  
//Dag S.

---

<div class="post-metadata">

**Author:** ![kaizerkaizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kaizerkaizer](https://www.ruby-forum.com/u/kaizerkaizer)\
**Post date:** [February 1, 2008, 2:04am UTC](https://www.ruby-forum.com/t/rake-db-create-fails-and-every-other-rake-task/127700/4 "2008-02-01T02:04:25Z")

</div>

Sorry I forgot to include the link:

[http://softiesonrails.com/2008/1/3/freezing-your-rails-application](http://softiesonrails.com/2008/1/3/freezing-your-rails-application)

Jeff

On Jan 31, 4:05Â pm, Dag S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![kaizerkaizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kaizerkaizer](https://www.ruby-forum.com/u/kaizerkaizer)\
**Post date:** [February 1, 2008, 2:03am UTC](https://www.ruby-forum.com/t/rake-db-create-fails-and-every-other-rake-task/127700/5 "2008-02-01T02:03:49Z")

</div>

On Jan 31, 4:05 pm, Dag S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> frozen? I don’t think it is. Hard to say right at the moment since I’m  
> writing from home, but I’ll get back about that in 8 hours. I’m using  
> gems as far as I know, didn’t know it was possible NOT to use gems…

Ah… well, when you upgrade rails, you’re also upgrading your  
application to use the new version, which in some cases will cause  
issues if you have an app written for Rails 1.x but you’ve now  
suddenly upgraded to 2.0.

We’ve written an introductory article on what freezing is all about  
here:

> > Are you running rake from the “root” of your application directory  
> > tree?
> 
> I’ve tried to run it from the “root” of my application, from the “db”  
> directory and migrate directory. All of which rendered the same error.

Rake should always be run from the root, so it sounds like you have  
something else wrong with the app.

Try this: what happens when you try:

ruby script\console

(again from the root of your application)

Do you get the Rails console started up? It should say “Loading  
development environment” or something similar, then give you an irb-  
style prompt (type “exit” to return to Windows).

> I’m running it on Windows XP
> 
> Thanks allot for the input, hope this makes it clearer about my problem.

No problem! 🙂

---

<div class="post-metadata">

**Author:** ![kaizerkaizer](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/k/45deac/32.png) [@kaizerkaizer](https://www.ruby-forum.com/u/kaizerkaizer)\
**Post date:** [February 1, 2008, 10:55am UTC](https://www.ruby-forum.com/t/rake-db-create-fails-and-every-other-rake-task/127700/6 "2008-02-01T10:55:17Z")

</div>

Some further background to what I’m doing with my application. I’ve  
based it on RESTful authentication plugin, and built in file\_column  
plugin, and nothing else really. The error appeared the first time ever  
after installing rMagick and the attachmen\_fu plugin.

> Ah… well, when you upgrade rails, you’re also upgrading your  
> application to use the new version, which in some cases will cause  
> issues if you have an app written for Rails 1.x but you’ve now  
> suddenly upgraded to 2.0.

Well, I’m sure I did NOT freeze my app(efter reading the article) ;D

> Rake should always be run from the root, so it sounds like you have  
> something else wrong with the app.

I can only think of one change I’ve done to the gems and rails before I  
decided to update it and that was installing rMagick and its  
gems…could installing the rMagick gem screw up the other gems in some  
odd way?

> Try this: what happens when you try:
> 
> ruby script\console

The console starts up and says something like “Loading  
development environment”
