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

migration: postgres mes-adresses-api #945

Merged
merged 19 commits into from
Sep 10, 2024
Merged

Conversation

fufeck
Copy link
Contributor

@fufeck fufeck commented Jul 17, 2024

@fufeck fufeck marked this pull request as draft July 17, 2024 13:11
@fufeck fufeck requested a review from MaGOs92 July 24, 2024 14:05
@fufeck fufeck marked this pull request as ready for review August 26, 2024 07:29
@fufeck
Copy link
Contributor Author

fufeck commented Aug 26, 2024

BUG BUILD GITHUB: vercel/next.js#69263

@fufeck fufeck changed the title Fufeck migration postgres migration: postgres mes-adresses-api Aug 28, 2024
return [...prevMarkers, { _id: uniqueId(), ...marker }];
return [
...prevMarkers,
{ id: new Types.ObjectId().toHexString(), ...marker },
Copy link
Contributor

Choose a reason for hiding this comment

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

Pour les positions je trouve que ça serait plus élégant d'utiliser des UUIDs, là côté front ça nous fait importer mongoose juste pour générer les objectIds et côté back on utilise la fonction custom pour la primary key alors qu'un petit @PrimaryGeneratedColumn("uuid") ferait le taff

Copy link
Contributor

Choose a reason for hiding this comment

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

J'ai fait un petit analyze, mongoose prend une place monstre... Si tu veux pas pour les uuid, je dirais on continue avec le uniqueId de lodash côté front et on détecte côté back si c'est une insertion on génère un ObjectId (sur le format de l'ID)
Capture d’écran 2024-08-29 à 16 19 05

Copy link
Contributor Author

Choose a reason for hiding this comment

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

J'ai opté pour la deuxième solution, comme il y a this.id = new ObjectId().toHexString();, si l'on remet la ligne return [...prevMarkers, { _id: uniqueId(), ...marker }]; cela marche quand même (l'id est écrasé par le BeforeInsert de l'entity position) donc pas de soucis ;)

@fufeck fufeck requested a review from MaGOs92 September 2, 2024 08:51
@fufeck fufeck merged commit 3c7b339 into master Sep 10, 2024
6 checks passed
@fufeck fufeck deleted the fufeck_migration_postgres branch September 10, 2024 07:58
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