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

[FEATURE] Script de migration des données CGUs de Pix Orga vers le nouveau modèle (PIX-15583) #10787

Open
wants to merge 3 commits into
base: dev
Choose a base branch
from

Conversation

P-Jeremy
Copy link
Contributor

@P-Jeremy P-Jeremy commented Dec 11, 2024

🎄 Problème

Avec la nouvelle table legal-document-versions, nous avons besoin de migrer les acceptations de CGUs Pix Orga actuelles des utilisateurs vers le nouveau modèle.

🎁 Proposition

Dans le contexte legal-documents, créer un script en utilisant la nouvelle architecture des scripts.

Convert users orga CGU data to legal-document-versions-user-acceptances

Options:
  --dryRun         Execute the script in dry run mode [boolean] [default: false]
  --batchSize      Size of the batch to process         [number] [default: 1000]
  --throttleDelay  Delay between batches in milliseconds [number] [default: 300]
  --help           Show help                                           [boolean]
  • Pour parer la contrainte d'un trop grand nombre d'utilisateurs impactés, Le script va utiliser du batch (batchSize = 1000) et du throttle (throttleDelay = 300).
  • Un mode dryRun permet de simuler l'exécution du script sans modification en base de données.

🧦 Remarques

Note

Le script add-new-legal-document-version a été déplacé dans le contexte legal-documents: src/legal-documents/scripts/add-new-legal-document-version.js

🎅 Pour tester

Pré-requis

Créer une entrée dans la table legal-document-versions :

node src/legal-documents/scripts/add-new-legal-document-version.js --type 'TOS' --service 'pix-orga' --versionAt '2024-01-01'

Vérifier que le document a été ajouté :

select * from "legal-document-versions";

Vérifier que la table legal-document-version-user-acceptances est vide :

select * from "legal-document-version-user-acceptances";

Vérifier les utilisateurs éligibles à la migration :

select * from "users" where "pixOrgaTermsOfServiceAccepted"=true;

Lancer le script en dry-run :

node src/legal-documents/scripts/convert-users-orga-cgu-data.js --dryRun

Vérifier que le nombre d'utilisateurs à migrer est correct

Lancer le script en dry-run avec un batch de 1 :

node src/legal-documents/scripts/convert-users-orga-cgu-data.js --dryRun --batchSize=1

Vérifier qu'il y a 1 batch exécuté par utilisateur à migrer

Lancer la migration :

node src/legal-documents/scripts/convert-users-orga-cgu-data.js

Vérifier que la table legal-document-version-user-acceptances est remplie

select * from "legal-document-version-user-acceptances";

@P-Jeremy P-Jeremy self-assigned this Dec 11, 2024
@P-Jeremy P-Jeremy changed the base branch from dev to pix-15582-add-new-legal-document-version-script December 11, 2024 15:29
@pix-bot-github
Copy link

Une fois les applications déployées, elles seront accessibles via les liens suivants :

Les variables d'environnement seront accessibles via les liens suivants :

@P-Jeremy P-Jeremy force-pushed the pix-15582-add-new-legal-document-version-script branch from 0755aed to 9564e26 Compare December 12, 2024 10:49
@P-Jeremy P-Jeremy force-pushed the pix-15583-migrate-users-orga-cgu-data-to-legal-document-version-user-acceptances branch from b5112f8 to 671aed4 Compare December 12, 2024 10:58
@P-Jeremy P-Jeremy force-pushed the pix-15582-add-new-legal-document-version-script branch from 9564e26 to 2f1b493 Compare December 12, 2024 13:34
@P-Jeremy P-Jeremy force-pushed the pix-15583-migrate-users-orga-cgu-data-to-legal-document-version-user-acceptances branch from 671aed4 to 4c07b66 Compare December 12, 2024 14:11
@P-Jeremy P-Jeremy force-pushed the pix-15582-add-new-legal-document-version-script branch from 2f1b493 to d5a59d2 Compare December 12, 2024 14:37
@P-Jeremy P-Jeremy force-pushed the pix-15583-migrate-users-orga-cgu-data-to-legal-document-version-user-acceptances branch from 4c07b66 to 6d94e58 Compare December 12, 2024 14:38
@P-Jeremy P-Jeremy force-pushed the pix-15582-add-new-legal-document-version-script branch 2 times, most recently from 11d9688 to 53a236a Compare December 12, 2024 16:01
@P-Jeremy P-Jeremy force-pushed the pix-15583-migrate-users-orga-cgu-data-to-legal-document-version-user-acceptances branch from 6d94e58 to 9700a13 Compare December 12, 2024 16:11
@P-Jeremy P-Jeremy force-pushed the pix-15582-add-new-legal-document-version-script branch from 53a236a to 567e203 Compare December 12, 2024 16:33
lego-technix

This comment was marked as resolved.

@P-Jeremy P-Jeremy force-pushed the pix-15582-add-new-legal-document-version-script branch from 567e203 to 522c27a Compare December 13, 2024 08:10
@P-Jeremy P-Jeremy force-pushed the pix-15583-migrate-users-orga-cgu-data-to-legal-document-version-user-acceptances branch from 9700a13 to e5d75cc Compare December 13, 2024 08:13
@P-Jeremy
Copy link
Contributor Author

Quand j'exécute la première ligne de commande donnée pour les tests j'obtiens l'erreur suivante :

TypeError: versionAt.trim is not a function

La branche n'était pas encore rebase sur la précédente 😉

Tout devrait être bon maintenant

@bpetetot bpetetot force-pushed the pix-15582-add-new-legal-document-version-script branch 2 times, most recently from e13c998 to 7c9a76c Compare December 13, 2024 09:59
@bpetetot bpetetot force-pushed the pix-15582-add-new-legal-document-version-script branch 2 times, most recently from 5cd3feb to 3d10d97 Compare December 13, 2024 10:22
@pix-service-auto-merge pix-service-auto-merge force-pushed the pix-15582-add-new-legal-document-version-script branch 2 times, most recently from 998889d to 8222a3a Compare December 13, 2024 10:28
Base automatically changed from pix-15582-add-new-legal-document-version-script to dev December 13, 2024 10:34
@P-Jeremy P-Jeremy force-pushed the pix-15583-migrate-users-orga-cgu-data-to-legal-document-version-user-acceptances branch from e5d75cc to 56252ba Compare December 13, 2024 10:57
@P-Jeremy P-Jeremy force-pushed the pix-15583-migrate-users-orga-cgu-data-to-legal-document-version-user-acceptances branch from 56252ba to 6294267 Compare December 13, 2024 13:53
@bpetetot bpetetot force-pushed the pix-15583-migrate-users-orga-cgu-data-to-legal-document-version-user-acceptances branch 3 times, most recently from 9cf1281 to e0532f8 Compare December 16, 2024 16:10
Copy link
Contributor

@lego-technix lego-technix left a comment

Choose a reason for hiding this comment

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

✅ Lu et testé fonctionnellement avec succès 👍

@bpetetot bpetetot force-pushed the pix-15583-migrate-users-orga-cgu-data-to-legal-document-version-user-acceptances branch from e0532f8 to c415447 Compare December 17, 2024 09:24
@bpetetot bpetetot force-pushed the pix-15583-migrate-users-orga-cgu-data-to-legal-document-version-user-acceptances branch from c415447 to 1bfd975 Compare December 17, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants