Initial thoughts around API, DB layer.

This commit is contained in:
2019-02-15 00:00:20 -06:00
commit 0d2efe4bcc
16 changed files with 314 additions and 0 deletions

25
api/Makefile Normal file
View File

@ -0,0 +1,25 @@
PGSQL_CONTAINER_ID=`cat postgres.container.id`
DB_NAME="personal_measure"
start-db: start-postgres
postgres.container.id:
docker run --name postgres-$(DB_NAME) -e POSTGRES_PASSWORD=password -p 5500:5432 -d postgres > postgres.container.id
sleep 5
PGPASSWORD=password psql -p 5500 -U postgres -h localhost -c "CREATE DATABASE $(DB_NAME);"
db_migrate up -c database-local.json
start-postgres: postgres.container.id
docker start $(PGSQL_CONTAINER_ID)
db_migrate up -c database-local.json
stop-postgres: postgres.container.id
docker stop $(PGSQL_CONTAINER_ID)
delete-postgres-container:
-docker stop $(PGSQL_CONTAINER_ID)
docker container rm $(PGSQL_CONTAINER_ID)
rm postgres.container.id
connect:
PGPASSWORD=password psql -p 5500 -U postgres -h localhost