Can I use the app/sql folder to synch the database between Local developers using Git?

I am curious about versioning the database files between users. Potentially, could this folder be synched using Git? I’m looking for a way to help my team to share and synch database changes/content with eachother, and even with Staging. Our client uploads content to Staging while we are developing, and being able to pull down that content as we work (without a full site pull which would overwrite our local changes) would be awesome.

Our developers are not in the same place (1 is remote) and being able to synch the database between us would be really useful for things like settings, image uploads, etc. I know this is basically a can of worms because database synching esp in WP is very complex and difficult. I’d atleast like to play around with it and see what happens.

Since we already have this automated sql dump, separated into individual tables which is awesome, could I potentially put the app/sql folder in Git, and manage the changes through a Git workflow? If a dev could do a Git pull, synching the database files before opening Local, could it load those updated sql files and run the new synched database?

PS: I love the “open draft” feature in this forum!!

Hey @jamieschmid

While you could definitely share the database files between your developers with Git, it wouldn’t work great for actually syncing them. Syncing two databases is extremely complex.

Each row in a WordPress table has an auto-incrementing ID. This ID has to be unique, and if the developers were working on something at the same time they would both get assigned the same auto-incrementing IDs.
i.e. If they both create a new unique page, both will be assigned the next ID number.

When you went to sync their changes tables, this would break the database, since now two different pages have the same ID.
This complexity is multiplied since WordPress stores different bits of information in different tables.