diff --git a/Makefile b/Makefile index 04cbeb6..f9c1d84 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ BACKEND_CONTAINER_NAME=python_backend -.PHONY: docker/start docker/start-build docker/clean backend/test backend/migrate backend/upgrade +.PHONY: docker/start docker/start-build docker/clean backend/test backend/migrate backend/upgrade backend/init # Docker commands: @@ -15,6 +15,9 @@ docker/clean: # Backend commands: +backend/init: + docker compose exec $(BACKEND_CONTAINER_NAME) python3 -m flask --app main db init + backend/migrate: @if [ "$(message)" = "" ]; then \ echo "Please provide a migration message. Usage: make migrate message='Your migration message'"; \ diff --git a/README.md b/README.md index 3348031..63dcac5 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,8 @@ Frontend Application (React): Provides a user-friendly interface for browsing an 2. To start the services run `make docker/start` +3. After starting the services, run the following make commands to setup the database and schemas: `backend/init`, `backend/migration`, `backend/upgrade` + ### Makefile Commands This Makefile provides convenient targets to automate common development tasks. @@ -47,6 +49,8 @@ This Makefile provides convenient targets to automate common development tasks. - **docker/clean**: Remove volumes and delete all images associated with the containers defined in the `docker-compose.yml` file. +- **backend/init**: Inits Flask migration folder. + - **backend/migrate**: Runs Flask migration with a specified message. - **backend/upgrade**: Upgrades the database schema using Flask. diff --git a/backend/.gitignore b/backend/.gitignore index e1c5f70..02b404d 100644 --- a/backend/.gitignore +++ b/backend/.gitignore @@ -24,7 +24,6 @@ var/ *.egg-info/ .installed.cfg *.egg - # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. @@ -90,4 +89,5 @@ ENV/ # Rope project settings .ropeproject -*.code-workspace \ No newline at end of file +*.code-workspace +migrations/ \ No newline at end of file