- Install dependencies:
npm install
- Create development and test databases:
createdb thingful
,createdb thingful-test
- Create database user:
createuser thingful
- Grant privileges to new user in
psql
:GRANT ALL PRIVILEGES ON DATABASE thingful TO thingful
GRANT ALL PRIVILEGES ON DATABASE "thingful-test" TO thingful
- Prepare environment file:
cp example.env .env
- Replace values in
.env
with your custom values. - Bootstrap development database:
npm run migrate
- Bootstrap test database:
npm run migrate:test
For tests involving time to run properly, your Postgres database must be configured to run in the UTC timezone.
- Locate the
postgresql.conf
file for your Postgres installation.- OS X, Homebrew:
/usr/local/var/postgres/postgresql.conf
- OS X, Homebrew:
- Uncomment the
timezone
line and set it toUTC
as follows:
# - Locale and Formatting -
datestyle = 'iso, mdy'
#intervalstyle = 'postgres'
timezone = 'UTC'
#timezone_abbreviations = 'Default' # Select the set of available time zone
- To seed the database for development:
psql -U thingful -d thingful -a -f seeds/seed.thingful_tables.sql
- To clear seed data:
psql -U thingful -d thingful -a -f seeds/trunc.thingful_tables.sql
- Start application for development:
npm run dev
- Run tests:
npm test