Skip to content

Commit

Permalink
fix: backend migrations setup
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielborgesdm committed Aug 11, 2024
1 parent 68d72d3 commit 92c8e0b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -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:

Expand All @@ -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'"; \
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions backend/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -90,4 +89,5 @@ ENV/
# Rope project settings
.ropeproject

*.code-workspace
*.code-workspace
migrations/

0 comments on commit 92c8e0b

Please sign in to comment.