On 01/25/2011 10:25 AM, Hans-Rudolf Hotz wrote:
On Jan 25, 2011, at 3:40 PM, Hans-Rudolf Hotz wrote:
Once again be careful with what you are doing, and don't blame me if you
create a mess ;)

PgAdmin ( http://www.pgadmin.org/ ) is a GUI application to manage Postgres 
databases - it might be a friendlier option than running direct SQL queries 
with 'psql'.

Before directly manipulation your DB, you can/should back it up with the 
following command:
$ pg_dump -U USER DB > galaxy_db.sql

If something does go wrong, you can at least revert the data to a valid state.

I use the following script to replicate the production database to the 
development database, and then it's easier to experiment with any SQL command 
you want without affecting the production server:

DATE=$(date "+%Y_%m_%d_%H%M%S")



echo "Dumping Prod-DB to:"
echo "  $FILE"
echo "(Enter Galaxyprod Password)"
pg_dump -c -U galaxyprod galaxyprod | sed 's/galaxyprod/galaxydevel/g' | gzip > 
"$FILE" || exit 1

echo "Dropping and re-creating Galaxy-Devel database."
echo "press CTRL-C to abort or ENTER to continue."
echo "(Enter GalaxyDevel Password)":
zcat "$FILE" | psql -U galaxydevel galaxydevel || exit 1

The "pg_dump -c" will add the SQL commands to drop and re-create the tables, so all 
tables in "galaxydevel" database are an exact copy.

galaxy-dev mailing list

Reply via email to