Added labels field to address schema and its migration file #263
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 existinglabelSchema
defined as followed :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 :
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