chore(partitions): add env to create partitions (#61)

* chore(partitions): add env to create partitions

* chore(partitions): rename env to DJANGO_MANAGE_DB_PARTITIONS

* chore(partitions): use True|False as value

* fix: begin comment with uppercase
This commit is contained in:
Pepe Fagoaga authored and GitHub committed 2024-10-29 16:16:09 +01:00
1 parent 98ec0532b2
commit 01045c973f
2 files changed
+17 -4

No files matched your search

+11
View File
@@ -31,14 +31,25 @@ start_worker() {
poetry run python -m celery -A config.celery worker -l "${DJANGO_LOGGING_LEVEL:-info}" -Q celery,scans -E
}
manage_db_partitions() {
if [ "${DJANGO_MANAGE_DB_PARTITIONS}" = "True" ]; then
echo "Managing DB partitions..."
# For now we skip the deletion of partitions until we define the data retention policy
# --yes auto approves the operation without the need of an interactive terminal
poetry run python manage.py pgpartition --using admin --skip-delete --yes
fi
}
case "$1" in
dev)
apply_migrations
apply_fixtures
manage_db_partitions
start_dev_server
;;
prod)
apply_migrations
manage_db_partitions
start_prod_server
;;
worker)