-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(db): Améliorer l'hydratation de la base de données en developpement #777
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La magie qui me semblerait intéressante serait de vérifier que le venv est bien actif et à jour (et le construire ou l’activer si besoin). C’est l’histoire de la dépendance $(VIRTUAL_ENV)
sur le C1. Fais-moi signe si tu es intéressé pour une explication de cette magie noire (et imparfaite) :)
dropdb --if-exists $(POSTGRESQL_ADDON_DB) | ||
createdb $(POSTGRESQL_ADDON_DB) | ||
python manage.py migrate | ||
python manage.py configure_bucket |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pinaillage, mais ce n’est pas de la DB, c’est pour minio.
Une fois que c’est fait, normalement pas besoin de le refaire.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
docker exec -ti commu_postgres dropdb $POSTGRESQL_ADDON_DB -U $POSTGRESQL_ADDON_USER --if-exists --echo | ||
dropdb $POSTGRESQL_ADDON_DB -U $POSTGRESQL_ADDON_USER --if-exists --echo | ||
|
||
echo "creating new db" | ||
docker exec -ti commu_postgres createdb $POSTGRESQL_ADDON_DB -O $POSTGRESQL_ADDON_USER -U $POSTGRESQL_ADDON_USER --echo | ||
createdb $POSTGRESQL_ADDON_DB -O $POSTGRESQL_ADDON_USER -U $POSTGRESQL_ADDON_USER --echo | ||
|
||
echo "restoring db" | ||
docker exec -ti commu_postgres pg_restore -U $POSTGRESQL_ADDON_USER --dbname=$POSTGRESQL_ADDON_DB --format=c --clean --no-owner --verbose /backups/$DB_BACKUP_NAME | ||
pg_restore -U $POSTGRESQL_ADDON_USER --dbname=$POSTGRESQL_ADDON_DB --format=c --clean --no-owner $DB_BACKUP_PATH | ||
|
||
echo "restarting db" | ||
docker-compose down postgres; docker-compose up postgres -d |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ces changements font que le dev doit avoir installé le client PostgreSQL sur sa machine. Pas bien grave, mais peut-être l’ajouter dans le README ?
Description
🎸 Ajout de la commande
resetdb
dans le fichierMakefile
pour automatiser l'hydratation d'une DB de dev🎸 Amélioration du script de restauration des dump de DB : suppression surcouche
docker
, ajout des migrationsType de changement
🚧 technique