2

Git is excellent tool: you could switch to the one of previous versions and bisect the history to locate the bug.

But actually you could not, because when you're switching to the old release, your DB remains in its most recent state, so your Web app won't work at all.

Is there any common solution on how to work around that?

Some thoughts:

  • I can't add the entire DB into every commit
  • I can't use migration back and forward, because I'm losing data in back migrations. The data is not a part of the structure, but it is handy for debug.
  • And of course, I need something to be in sync with Git (a hook?), otherwise I'm getting extra time expenses which are not well.
1
  • Use backups for your recent data and store the schema of your database in your git repository as it evolves. Probably the simplest solution. Commented May 17, 2012 at 9:31

2 Answers 2

1

The cleanest solution would be having a script that creates a database with dummy/testing data. Since this script and your database structure would be versioned, it would always create the correct one.

However, you cannot automatically perform a back-migration since the information about structure changes happening after the current commit are not available.

Sign up to request clarification or add additional context in comments.

1 Comment

Over the years I ended up with the same solution. If you have a good seed that covers all your important test cases, you could simply recreate the whole database on any checkout.
1

try this tool

https://hub.docker.com/r/arelis/gitdb

its a version control to mysql and use git for control version

1 Comment

While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.