Migrate to .sql file

Would anyone know how to make “rake migrate” or “rake db:schema:load”
produce an SQL file instead of operating directly on the DB?

The reason that I ask is that my ROR hosting (servage) does not seem
to allow me to connect to the DB server from the internet or to
execute rake.

So am I stuck with creating the SQL manually or will rails do it for
me?


Christian

rake db:structure:dump # Dump the database structure to a SQL file

also try ‘rake -T’ for a list of helpful rake tasks

On 8/28/07, Christian M. [email protected] wrote:

me?


Christian


David Andrew T.
http://dathompson.blogspot.com

Thanks David,

But when I look into databases.rake, it appears that it actually uses
the client for the given DB to make the dump from the DB.

It seems that I forgot to mention that I use postgresql for
development and my hosting service uses MySQL. So the schema that I
get from my development DB is unusable on the hosting service.

I guess that I should just use MySQL for development… …Or
implement “rake db:schema:generate”.


Christian M.

On 28 Aug., 20:10, “David Andrew T.”

If you intention is to be able to use MySQL for your production server
and
Postgres for your development then you could just set them up in your
config/database.yml file as such.

If you use ‘rake db:schema:dump RAILS_ENV=development’ against your
Postgres/dev database, this will create a rubified schema of your
database.
You could then use ‘rake db:schema:load RAILS_ENV=production’ against
your
MySQL/env database. (This is presuming that you have set your
database.ymlto reflect these configurations.)

btw…this will not give you a true dump of your database (with all of
the
data), just the schema.

If the problem is that you do not have shell access to your server and
so
cannot call ‘rake’ from the command line there, but have to update the
database schma through some other web based sql loader, then I would
recommend just switching your local database to whatever you are using
for
your production and save yourself the frustration. Simply solve the
problem
and solve the problem simply as they say.

Hope this helps.

On 8/28/07, Christian M. [email protected] wrote:

also try ‘rake -T’ for a list of helpful rake tasks

The reason that I ask is that my ROR hosting (servage) does not seem
David Andrew T.http://dathompson.blogspot.com


David Andrew T.
http://dathompson.blogspot.com

It did help. I go for “Simply solve the problem and solve the problem
simply as they say” and install MySQL.

And then I will dream of having the time and skills to implement “rake
db:schema:generate”.

Thanks.


Christian M.

On 28 Aug., 21:30, “David Andrew T.”