Postgres have the tool pg_dump the which is used for do backups.
$ pg_dump -i -F c -b -v -f backup_name.bk database_name
add -s, –schema-only: for dump only the schema, no data.
Create the database if no existing:
$ createdb --locale=en_US.UTF-8 --owner=postgres -W database_name
Restore backup:
$ pg_restore -i -d database_name -v backup_name.bk
Anuncios