MSRS/Makefile

31 lines
783 B
Makefile
Raw Permalink Normal View History

2021-04-18 20:58:18 +02:00
MSRS_DB_BACKEND ?= mysql
MSRS_SQLITE_FILE ?= msrs.sqlite3
# Discover virtualenv location
PYTHON ?= $(shell find -mindepth 3 -maxdepth 3 -path "*/bin/python")
ifeq ($(PYTHON),)
$(error No virtualenv found)
endif
VENVBIN := $(dir $(PYTHON))
.PHONY: server celery beat
server:
$(PYTHON) manage.py runserver
.PHONY: migrations migrate
migrations:
$(PYTHON) manage.py makemigrations
migrate:
$(PYTHON) manage.py migrate
.PHONY: reset_db rewrite_migrations
reset_db:
@case "$(MSRS_DB_BACKEND)" in \
mysql) printf "Please drop your MySQL/MariaDB tables and press enter"; read; ;; \
sqlite3) echo 'rm -f "$(MSRS_SQLITE_FILE)"'; rm -f "$(MSRS_SQLITE_FILE)"; ;; \
esac
make migrate
rewrite_migrations:
@echo "We have data in production. This is not allowed any more."; exit 1