So I have a file which I want a beginning section to tear down a db if exists, then create one and connect to it.
Thus far I have:
Drop DATABASE IF EXISTS db_name;
CREATE DATABASE db_name;
<don't know what goes here to connect to db_name>
I have googled a lot and keep finding how to do it from the psql command prompt but not how to connect like I am looking to do from a file.
Any help would be appreciated.