Skip to content
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

fix: delete position type inconnue #496

Merged
merged 3 commits into from
Jan 14, 2025
Merged

Conversation

fufeck
Copy link
Collaborator

@fufeck fufeck commented Jan 7, 2025

CONTEXT

Le type de position inconnue ne passe pas le validateur
Il faut retirer la possibilité d'utiliser le type de position inconnue dans l'application mes-adresses

FONCTIONNALITE

  • Mettre type position entrée par default a l'import
  • Changer l'enum
  • Ajouter les validateur de position sur les dto
  • Faire une migration de toute les ancienne positions

PR

@fufeck fufeck requested a review from MaGOs92 January 7, 2025 14:09
Copy link
Collaborator

@MaGOs92 MaGOs92 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

`ALTER TABLE "positions" ALTER COLUMN "type" TYPE "public"."positions_type_enum_old" USING "type"::"text"::"public"."positions_type_enum_old"`,
);
await queryRunner.query(
`ALTER TABLE "positions" ALTER COLUMN "type" SET DEFAULT 'entrée'`,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pour le down, il faudrait set le default à "inconnue"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ça me parait compliqué toutes ces manipulations de l'enum... Y'a pas juste moyen de supprimer / ajouter une valeur dans l'enum?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alors pour la première remarque, le type par DEFAULT est deja entrée avant la migration
Ensuite il existe une commande postgres pour ADD VALUE mais pas pour DROP VALUE https://www.postgresql.org/docs/14/sql-altertype.html, j'ai quand même essayé en local (dans le doute) la commande DROP VALUE et ca n'existe pas

Procfile Outdated
clock: yarn start:cron
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On pourrait pas se servir d'une variable d'env pour lancer les migrations en mode auto ou non?
Je vois dans la doc de Scalingo qu'on peut faire ce genre de chose : https://doc.scalingo.com/platform/app/procfile

Le Procfile :
clock: yarn start:cron
postdeploy: bash bin/postdeploy.sh

et le script postdeploy.sh =>
#!/bin/bash

if [ "$LAUNCH_MIGRATION_AT_START" = "true" ] ; then
exec yarn typeorm:migration:run
fi

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Je suis pas très fan de la solution mais c'est peut être mieux que a l'heure actuelle

@fufeck fufeck merged commit 0eb1a72 into master Jan 14, 2025
3 checks passed
fufeck added a commit that referenced this pull request Jan 14, 2025
fufeck added a commit that referenced this pull request Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants