[Rails] a remote database issue
Dick Davies
rasputnik at hellooperator.net
Tue Mar 1 22:35:22 GMT 2005
* Kim <kim at tinker.com> [0312 16:12]:
>
> On Mar 1, 2005, at 4:22 AM, Dick Davies wrote:
>
> >* Robby Russell <robby at planetargon.com> [0211 22:11]:
> >> rake outputs:
> >>
> >>>pg_dump: [archiver (db)] connection to database "dbname" failed:
> >The :clone_structure_to_test can't work remotely
> I also have a problem with this and I am looking into changing the way
> the test database is cloned so that it doesn't use dropdb and createdb.
In essence a drop/createdb is not much different to deleting all tables/
indexes/sequences and rebuilding them, and we are only talking about the
test db in any case. The only benefit is a warm fuzzy feeling, and I'm not
sure if the extra complexity (in the Rakefile or the adapter) is worth it.
> I am also looking into adding the
> capability of having the test setup do its cloning as a database user
> that owns the
> database and has full rights to it and then logging off before running
> the tests as
> the user I have the web site log in as which has much fewer permissions.
Again it would be nice, but it does seem to increase the effort in getting a
test environment up and running.
> >a) secure the db properly
> >b) run the tests against a remote db
> There is an undocumented environment variable you can set. If you set
> PQpass to your password, it will not prompt for one.
Nice, thanks. Actually it seems PGPASSWORD is what you're describing,
but setting that up before system('pg_dump ...') should DTRT.
I'll have a go tweaking the Rakefile.
> >Personally I'd like to see us get away from pg_dump and find another
> >way to
> >pull the schema from development and drop everything from the test db
> >(rather than dropdb/createdb).
> >I'm beginning to think this should be done in the adapter..
> I am looking into this sort of thing. However, due to my other
> projects, it may
> be a while before I get something that works. Do you know if anyone
> else is working on this so I don't duplicate someone else's effort?
Not that I know of. I notice the mysql adapter can do this, but from a quick
glance at the code its using 'SHOW xxx' type commands. psql supports
the same features with its '\' commands, but if you've ever run 'psql -E' you'll
know what sort of nosebleed code that generates...
--
'Everybody's a jerk. You, me, this jerk.'
-- Bender
Rasputin :: Jack of All Trades - Master of Nuns
More information about the Rails
mailing list