psql --quiet -h hostname -U user_name -w -d postgres -f "/path/to/prepared_script.sql"
Last active
July 18, 2019 22:40
-
-
Save abelcallejo/97ac42490ad6b8162252a3086d26d354 to your computer and use it in GitHub Desktop.
Executing a PostgreSQL script using a local file
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
/** Deleting then recreating a database **/ | |
\c postgres; | |
DROP DATABASE IF EXISTS database_name; | |
CREATE DATABASE database_name OWNER user_name; | |
\c database_name; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment