Last active
December 26, 2021 19:42
-
-
Save nandiheath/a7c46440785d9c1e312f4f79285d46e9 to your computer and use it in GitHub Desktop.
PSQL commands
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# psql dump table | |
source .env | |
pg_dump --host $POSTGRES_HOST --user $POSTGRES_USER --format custom --section data --on-conflict-do-nothing --inserts --file "$TABLE.sql" --table "$TABLE" $POSTGRES_DATABASE | |
# psql restore data | |
pg_restore -h 127.0.0.1 -U {user} -d {database} {table}.sql |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment