Executing hooks on existing collections. #229
-
Hello, I have some hooks that I would like all images to execute going forward. Only issues is, if I want to execute those hooks on the existing documents in the collection then I have to go to the admin panel, save, go back, next, save go back, next, save go back.... Is there any way I can script this out? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hey @richardvanbergen — I have the perfect solution for you! You can boot Payload in https://github.com/payloadcms/nextjs-custom-server/blob/master/seed/index.js Locally booted Payload completely dodges all HTTP activity like opening the REST and GraphQL APIs, and you can use the Local API to do whatever you want (including resaving all of your images so their hooks run.) Would this help? |
Beta Was this translation helpful? Give feedback.
Hey @richardvanbergen — I have the perfect solution for you!
You can boot Payload in
local
mode, which is perfect for running seed scripts, migrations, and more. There is an example of how to do this here:https://github.com/payloadcms/nextjs-custom-server/blob/master/seed/index.js
Locally booted Payload completely dodges all HTTP activity like opening the REST and GraphQL APIs, and you can use the Local API to do whatever you want (including resaving all of your images so their hooks run.)
Would this help?