I am working with a dockerized Drupal environment in which we want to track content alongside our theme, modules, etc in source control. We achieve content tracking by using
mysqldump to dump the database to disk, with one table per file. Then when the environment is created using Docker Compose, the SQL files on disk recreate the database state. We also track certain files from
sites/default/files like uploaded images and copy those to the Drupal container on environment start.
Whenever we make a change in our environment, we want to persist the change in our source control by overwriting the SQL files on disk, but even for innocuous changes like logging in a user and logging them back out (theoretically ending up where you began), there are a lot of modified tables:
Several of these are related to user data, but they are mostly caching-related, and the same tables change for other innocuous changes.
Ideally I'd like to prevent "noise" in our commits by minimizing the number of modified files whenever we make a content change. For these cache tables, is it possible to only track their table
CREATE statement and not the content of the cache, and just recreate the cache content somehow when we spin up a new instance of the Docker environment?