add install-db in Makefile

This commit is contained in:
Sam 2018-09-09 10:48:32 +02:00
parent 3e22feba73
commit 124fe88ec1
3 changed files with 8 additions and 1 deletions

View File

@ -13,6 +13,11 @@ clean-install:
rm -fr $(NODE_MODULES) rm -fr $(NODE_MODULES)
rm -fr $(VENV) rm -fr $(VENV)
install-db:
psql -U postgres -f fittrackee_api/db/create.sql
$(FLASK) db upgrade --directory $(MIGRATIONS)
$(FLASK) init_data
init-db: init-db:
$(FLASK) drop_db $(FLASK) drop_db
$(FLASK) db upgrade --directory $(MIGRATIONS) $(FLASK) db upgrade --directory $(MIGRATIONS)

View File

@ -14,7 +14,7 @@ export PIPENV_VENV_IN_PROJECT=true
# Python env # Python env
PYTHON_VERSION ?= python PYTHON_VERSION ?= python
VENV = $(PWD)/fittrackee_api/.venv VENV = $(PWD)/.venv
PYTHON = $(VENV)/bin/python PYTHON = $(VENV)/bin/python
PIPENV = $(shell command -v pipenv 2> /dev/null) PIPENV = $(shell command -v pipenv 2> /dev/null)
FLASK = $(VENV)/bin/flask FLASK = $(VENV)/bin/flask

View File

@ -1,5 +1,7 @@
DROP DATABASE IF EXISTS fittrackee; DROP DATABASE IF EXISTS fittrackee;
DROP DATABASE IF EXISTS fittrackee_test; DROP DATABASE IF EXISTS fittrackee_test;
DROP USER fittrackee;
CREATE DATABASE fittrackee; CREATE DATABASE fittrackee;
CREATE DATABASE fittrackee_test; CREATE DATABASE fittrackee_test;
CREATE USER fittrackee WITH PASSWORD 'fittrackee'; CREATE USER fittrackee WITH PASSWORD 'fittrackee';