Skip to content

Commit

Permalink
[#122] Migrate database from A to B
Browse files Browse the repository at this point in the history
  • Loading branch information
dedenbangkit committed Apr 12, 2022
1 parent bae9df9 commit 227b602
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions scripts/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*.dump
14 changes: 14 additions & 0 deletions scripts/dump_dev_to_prod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash

export PGPASSWORD=""

test_db="the_test_db_name"
prod_db="the_prod_db_name"
db_file=./test.dump
db_user=isco
db_host=localhost

pg_dump -U "$db_user" -h $db_host -Fc $test_db > "$db_file"
dropdb -U $db_user -h $db_host --if-exists $prod_db
createdb -U $db_user -h $db_host -T template0 $prod_db
pg_restore -U $db_user -h $db_host -d $prod_db "$db_file"

0 comments on commit 227b602

Please sign in to comment.