Skip to content

Instantly share code, notes, and snippets.

@brain90
Last active April 18, 2016 17:00
Show Gist options
  • Save brain90/8e26c63f6fdf08431ecd4b8de255f9c7 to your computer and use it in GitHub Desktop.
Save brain90/8e26c63f6fdf08431ecd4b8de255f9c7 to your computer and use it in GitHub Desktop.
Deploy DB ke client, dengan preloaded data hanya sistem dan master table.
##### Pada SOURCE_DB #####
# Dump hanya schema saja dari seluruh object
$ pg_dump -Fc -U hcsuser -h localhost -s hcs_latest > hcs_latest_schema_only.dump --verbose
# Dump hanya konten dari object yg diinginkan (ex: sys tables, dan master table)
$ pg_dump -U hcsuser -h localhost -a -t user -t roles -t menu_roles -t master_* hcs_latest > hcs_master_content.sql --verbose
##### Pada TARGET_DB #####
# Create database
postgres=# create database client_hcs_db owner hcs_user;
# Restore skema
$ pg_restore -U hcsuser -h localhost -d client_hcs_db < hcs_latest_schema_only.dump --verbose
# Restore sys tables dan master tables
$ psql -U hcsuser -h localhost client_hcs_db < hcs_master_content.sql
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment