Hello! This is a data migration. We're going to be using these going forwards to maintain the live data in each copy of the codebase.
In this PR, we update the schema of Contact Us to use image instead of img - this will help the page editor on the backend select more user-friendly editor nodes to display to the admin.
There are four parts:
1) Apply the changes we want to the data-base file
2) Update the page schema in schemas.ts
3) Update the actual usages of this attribute. In this case, and probably most cases, that just meant updating the .pug file.
4) Creating the migration. We define the
type (for now, either 'UPDATE' or 'DELETE').
dateAdded. This is used to track whether migrations have been applied.
path. This tells the migration code what file to apply to.
migrator. This function takes in the old copy of the /data file, and transforms its contents to match the new schema.
After that, if you re-run npm run dev, you should see your migration take effect! The relevant /data file (in this case, /data/contact-us.json) will have been updated, and hopefully, your page will work as you've envisioned.
Hello! This is a data migration. We're going to be using these going forwards to maintain the live data in each copy of the codebase.
In this PR, we update the schema of Contact Us to use
image
instead ofimg
- this will help the page editor on the backend select more user-friendly editor nodes to display to the admin.There are four parts: 1) Apply the changes we want to the data-base file 2) Update the page schema in
schemas.ts
3) Update the actual usages of this attribute. In this case, and probably most cases, that just meant updating the.pug
file. 4) Creating the migration. We define thetype
(for now, either 'UPDATE' or 'DELETE').dateAdded
. This is used to track whether migrations have been applied.path
. This tells the migration code what file to apply to.migrator
. This function takes in the old copy of the/data
file, and transforms its contents to match the new schema.After that, if you re-run
npm run dev
, you should see your migration take effect! The relevant/data
file (in this case,/data/contact-us.json
) will have been updated, and hopefully, your page will work as you've envisioned.Happy migrating!