Skip to content
This repository has been archived by the owner on Jan 24, 2019. It is now read-only.

better db/table create docs #142

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
21 changes: 19 additions & 2 deletions README.md
Expand Up @@ -27,13 +27,30 @@ npm install

# copy default environment config
cp env.sample .env
```

You will then also need to create a database and set up the table definitions.

If you have installed PostgreSQL in a way that works without requiring a username and password, use:

```
# create a database; -U and -W are only necessary if your pg instance needs authentication
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-W forces the password prompt, but you'll get that on a passworded account anyway, so we can omit it from the instructions.

createdb webmaker
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to show -U in this instruction too, since it uses the format -U username


# create tables; -U and -W are only necessary if your pg instance needs authentication
psql -d webmaker -f scripts/create-tables.sql
```

If you installed PostgreSQL in such a way as to require a username and password, use:

```
# create a database; -U and -W are only necessary if your pg instance needs authentication
createdb -U dbusername -W dbuserpassword webmaker
createdb -U dbusername webmaker

# create tables; -U and -W are only necessary if your pg instance needs authentication
psql -U dbusername -W dbuserpassword -d webmaker -f scripts/create-tables.sql
psql -U dbusername -d webmaker -f scripts/create-tables.sql
```
If you did, note that both these commands will require you to type in your password. If you want your password to be automatically picked up by psql utilities, you can define an environment variable `PGPASSWORD` and set this to your password (but this really only makes sense if you only use psql for dev/testing purposes)

### Note: this will set up an empty database

Expand Down