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

Added labels field to address schema and its migration file #263

Merged

Conversation

antoineludeau
Copy link
Member

@antoineludeau antoineludeau commented Sep 20, 2023

I. Context :
The field "lieudit_complement_nom" is currently not handled is the new BAN-ID data schema. We need to add it to the data schema and migrate the postgresql structure to add the column

II. Enhancements :
This PR aims to add a new filed in the "address" schema :

labels: array().of(labelSchema).default(null).nullable() <= The field is not required BUT if existing, it has to fit with the already existing labelSchema defined as followed :

export const labelSchema = object({
  isoCode: string().trim().length(3).required(),
  value: string().trim().required(),
})

III. How to test

1- Use the migration file to modify your postgreSQL structure (adding a labels column into your Addresses table). Here is the following command to start :

npx sequelize-cli db:migrate --name 20230912161927-add-labels-to-addresses.cjs

You should see :

== 20230912161927-add-labels-to-addresses: migrating =======
== 20230912161927-add-labels-to-addresses: migrated (0.012s)

2- Download a BAL (csv) and make sure at least one of the address has a lieudit_complement_nom. If not, add it manually in the CSV and save it.
3- Use the initBALIntoBAN script on ID-Fix to push your BAL into the BAN.
4- Go in the PostgreSQL DB, on Addresses table and look for the address(es) that has(have) the lieudit_complement_nom.
5- Verify that the "labels" column is filled with the correct data.

IV. Complementary information

1- When deploying on production, make sure to do the migration before starting the ban-api and ban-worker

@antoineludeau antoineludeau changed the title Added complementaryLabels field to address schema and its migration file Added labels field to address schema and its migration file Sep 20, 2023
@antoineludeau antoineludeau self-assigned this Sep 21, 2023
@antoineludeau antoineludeau merged commit 38dbfa5 into master Sep 26, 2023
1 check passed
@antoineludeau antoineludeau deleted the antoineludeau/add-complementary-labels-to-address-schema branch September 26, 2023 16:03
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.

[BAN-Plateforme] : Ajout du champ "labels" dans le schéma de l'adresse
2 participants