#Migrating content/build from local database to production database

8 messages · Page 1 of 1 (latest)

next pebble
#

Hi, I have been working on a new site locally that I started using the Payload website template. I have the site ready, but can't figure out the right workflow to migrate all the content. I see that there are "migrations," but it seems that's for schema and not content. I see references to an export command, but my version 3.0 does not seem to have that. What is the right way to export my local collections and move them to the production instance?

wanton micaBOT
misty ermine
#

Hello! Some questions in advance:

which database adapter are you using? Mongodb/psql/sqlite?

do your collections have references between each other? (E.g. Page references to Categories)

Do you use idType uuid?

does your Production database include data which is not available on local?

#

If you don’t have references between the collections, you can most probably pull them via local api and push them based on if-not-exists-create :). manual way for node script - but works.

next pebble
#

Thank you for getting back. I am using Postgres and some collections have relationships

misty ermine
#

if you have references but don’t use idType uuid it‘s a bit more complicated - and you need to take care of referencing things

#

i must admit - for very content heavy databases I like the pattern of pulling the whole databae of prod to local - do + test the changes - and copy the whole database back to prod (replacing it entirely): pgdump + pgimport. This of course does not play nicely at all if production db contains content which changes on prod or does not make testing locally possible. But it is least error prone.

next pebble
#

I see. I guess I will fall back to pgdump and pgexports. I was really hoping I wouldn't have to do it this way