Payload Cloud | v1 -> v2 migration

default discord avatar
tinouti
3 weeks ago
4

Heya! I'm finally back to working on my Payload project after a bit of a hiatus, and I'm currently looking into migrating to the new and improved Payload v2 (congrats on the release btw 🥳).



I seem to have gotten things in a good place locally, but I'm wondering how I should go about running the migration script (

https://github.com/payloadcms/payload/releases/tag/v2.0.0#:~:text=ready%2Dto%2Dgo-,migration%20script,-for%20your%20versions

) on the Payload Cloud live environment.



Do I need to dump my db, import it locally, run the script there, dump my local db, delete the prod one, and reimport it on prod? Or is there a better way?

And as an aside: anything else I should know about or do before attempting to migrate my Payload Cloud project?



Bump 😊

  • discord user avatar
    denolfe
    Payload Team
    2 weeks ago

    Most would perform a DB backup just in case, then perform the migrations against prod.



    If you want to be doubly safe, you could even have a staging DB and test the migration on it.

  • default discord avatar
    tinouti
    2 weeks ago
    then perform the migrations against prod

    I think that's the part I'm missing. 😕



    How would I go about running that migration script against prod with Payload Cloud?


    Is there some kind of remote access I can get through a terminal, like ssh or something? 🤔



    (my apologies if that's obvious, I'm very clueless when it comes to all things dev ops, which is why I went with Payload Cloud to begin with 🥲)

  • discord user avatar
    denolfe
    Payload Team
    2 weeks ago

    Most would run the migrate command before the serve command



    In your npm scripts you could combine them to run migrate first

  • default discord avatar
    tinouti
    2 weeks ago

    Oooh I see, that makes sense, and that solves the follow up questions I had like: "how to time the db update with the Payload update / which one should come first"... Thanks Elliot! 🙏

Open the post
Continue the discussion in Discord
Like what we're doing?
Star us on GitHub!

Star

Connect with the Payload Community on Discord

Discord

online

Can't find what you're looking for?

Get help straight from the Payload team with an Enterprise License.