From 124fe88ec18e6ed1b2f664c7f2d09529ee672aa1 Mon Sep 17 00:00:00 2001 From: Sam Date: Sun, 9 Sep 2018 10:48:32 +0200 Subject: [PATCH] add install-db in Makefile --- Makefile | 5 +++++ Makefile.config | 2 +- fittrackee_api/db/create.sql | 2 ++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 623f2cbd..cb591386 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,11 @@ clean-install: rm -fr $(NODE_MODULES) rm -fr $(VENV) +install-db: + psql -U postgres -f fittrackee_api/db/create.sql + $(FLASK) db upgrade --directory $(MIGRATIONS) + $(FLASK) init_data + init-db: $(FLASK) drop_db $(FLASK) db upgrade --directory $(MIGRATIONS) diff --git a/Makefile.config b/Makefile.config index c0d6416c..4f298dad 100644 --- a/Makefile.config +++ b/Makefile.config @@ -14,7 +14,7 @@ export PIPENV_VENV_IN_PROJECT=true # Python env PYTHON_VERSION ?= python -VENV = $(PWD)/fittrackee_api/.venv +VENV = $(PWD)/.venv PYTHON = $(VENV)/bin/python PIPENV = $(shell command -v pipenv 2> /dev/null) FLASK = $(VENV)/bin/flask diff --git a/fittrackee_api/db/create.sql b/fittrackee_api/db/create.sql index 79ef9e50..be07ea44 100644 --- a/fittrackee_api/db/create.sql +++ b/fittrackee_api/db/create.sql @@ -1,5 +1,7 @@ DROP DATABASE IF EXISTS fittrackee; DROP DATABASE IF EXISTS fittrackee_test; +DROP USER fittrackee; + CREATE DATABASE fittrackee; CREATE DATABASE fittrackee_test; CREATE USER fittrackee WITH PASSWORD 'fittrackee';