add addMissingSchemaFields task - #5101
Conversation
…ation * main: (23 commits) PRO-8538: fix layout bug in mobile breakpoint preview that causes tiny collapsed columns (#5127) give color button a testable data attr (#5124) PRO-8530 autodetect ES bundles (#5120) Emphasize but unfocus in layout mode (#5125) Simplify layout max width (#5123) max width, anchors, labels (#5122) refactor and inject admin UI styles for layout (#5116) Color field swatches (#5118) Pro 8285 login case insensitive (#5100) fix paste bug (#5119) Implement change outlined on Discord (#5117) PRO-8374: Mute tooltip when edit is disabled (#5114) fix sticky when controls are disabled (#5115) enable logout and whoami routes if localLogin is false (#5098) add locale picker (#5090) enforce empty state font (#5113) sticky controls (#5106) Layout widget icon (#5112) Feature layout widget (#5031) PRO-8435: log what widget type was missing (#5110) ...
|
|
||
| ### Fixes | ||
|
|
||
| ## UNRELEASED |
There was a problem hiding this comment.
Recreating the section because this is not part of today's release, easier for me to handle future conflict.
| @@ -237,6 +250,10 @@ module.exports = { | |||
| // the @apostrophecms/migration:migrate task | |||
| async migrate(options) { | |||
| await self.emit('before'); | |||
There was a problem hiding this comment.
You should skip this line too, even though it means your task will have to explicitly call addMissingSchemaFields.
This is appropriate because:
- We used the
beforehook to implementaddMissingSchemaFields, which is a special kind of migration - Other people and other modules will likely do the same thing
- Michelin doesn't want anything else that smells like a migration at all to happen in this task.
There was a problem hiding this comment.
Regarding the following code
await self.apos.lock.withLock('@apostrophecms/migration:migrate', async () => {
await self.apos.migration.migrate(self.argv);
// Inserts the global doc in the default locale if it does not exist;
// same for other singleton piece types registered by other modules
for (const apostropheModule of Object.values(self.modules)) {
if (self.instanceOf(apostropheModule, '@apostrophecms/piece-type') && apostropheModule.options.singletonAuto) {
await apostropheModule.insertIfMissing();
}
}
await self.apos.page.implementParkAllInDefaultLocale();
await self.apos.doc.replicate(); // emits beforeReplicate and afterReplicate events
// Replicate will have created the parked pages across locales if needed,
// but we may still need to reset parked properties
await self.apos.page.implementParkAllInOtherLocales();
});Should I skip all apostropheModule.insertIfMissing + page.implementParkAllInDefaultLocale, doc.replicate & page.implementParkAllInOtherLocales too?
| await self.addMissingSchemaFields(); | ||
| } | ||
| }, | ||
| after: { |
There was a problem hiding this comment.
I see why you did this, but previously, these "requirements" were guaranteed to come last, even after the after event. And changing that is an unnecessary risk.
So, please make them individual handlers on a new requirements event which is fired after the after event has been safely awaited.
| // This is the right time to park pages, for instance, because the | ||
| // database is guaranteed to be in a stable state, whether because the | ||
| // site is new or because migrations ran successfully. | ||
| await self.emit('after'); |
There was a problem hiding this comment.
Emit a new requirements event "after after" 😄
…ation * main: fix tooltip prop (#5139) Radio icon buttons (#5121) Fix typos in some files (#5144) PRO-8571: fix the astro section template library bug introduced in astro 4.9.0 (#5140) bump nodemailer to v7 (#5138) Pro 8563 translation (#5134) release 4.23.0 (#5132) change disabled layout translation (#5131) max width for micro color label (#5130) uses operation name for key and id (test purpose) (#5129) Fix native actions params (#5128) moves widget operations to backend (#5111)
…ation * main: Pro 8541 switch locale empty doc (#5135)
* main: PRO-8708: bring back passing of the actual area options in the form developers expect to see them to custom insert menu item components (#5162) adds object of useful error when widget fails to render (#5141) add addMissingSchemaFields task (#5101) Pro 8360 box field (#5142) Pro 8671 fix localize modal (#5156) longPolling: false option (#5154) PRO-5472: file widget (#5126)
* main: PRO-8708: bring back passing of the actual area options in the form developers expect to see them to custom insert menu item components (#5162) adds object of useful error when widget fails to render (#5141) add addMissingSchemaFields task (#5101) Pro 8360 box field (#5142) Pro 8671 fix localize modal (#5156) longPolling: false option (#5154) PRO-5472: file widget (#5126)
Summary
Adds
@apostrophecms/migration:add-missing-schema-fieldstaskWhat are the specific steps to test this change?
@apostrophecms/migration:add-missing-schema-fieldsand@apostrophecms/migration:migratetasks maybe.What kind of change does this PR introduce?
(Check at least one)
Make sure the PR fulfills these requirements:
If adding a new feature without an already open issue, it's best to open a feature request issue first and wait for approval before working on it.
Other information: