Create databases with rake


#1

hi,
is there a way to create the database (say development and or
production) specified in database.yml with rake?
thanks,
Enrico


“The only thing necessary for the triumph of evil
is for good men to do nothing”
Edmund Burke


#2

A production database usually is much more than just the create
statement.
For testing and development I use sqlite, where no db creation is
necessary,
when you first start to use it it gets created automatically.


#3

Have you looked at the rake migrate utilities.

~A


#4

Isn’t migrations assuming the DB is already there?
I’m aware of the migrating functionality on tables and data, there’s
an execute method able to execute the query you pass but still…
isn’t it assuming the DB is alredy in place?
I know it’s just a matter of typing few words, I was just wondering
about a rake way to do it.
thanks


“The only thing necessary for the triumph of evil
is for good men to do nothing”
Edmund Burke


#5

you can initially import your schema with:

rake db_schema_import

but i’m not sure about the actual creation of DB.

-tak.


#6

Takashi Okamoto a écrit :

you can initially import your schema with:

rake db_schema_import

but i’m not sure about the actual creation of DB.

-tak.

IMHO, db_schema_import task does work only for SQLite. For MySQL I
always have to create “manually” the empty schemas needed (dev, test,
prod).
What about other DBMS ? I don’t know, a try costs nothing …

Didier