I have a question regarding the version control and database. My problem is that I have a branch 'b1' that is stable, now I have created another branch 'b2' and worked for couple of days. Now after few days I am to switching to my previous 'b1' branch.
But my problem is Mysql database still having same database as 'b2' branch. But I want to have the same database when I left with branch 'b1', only those table and those data.
How to achieve this?
To do this automatically, you would need to put all database files under version control. Additionally, since the database server doesn't expect those files to change without its knowledge, you would need to restart the server when switching branches. Of course, if the database is being written to, you would also need to commit the changes (in git) after every modification.
If you need this kind of functionality, consider switching to a server-less database that is more suited for this kind of operation. For example, SQLite has no separate server process and holds all database contents in a single file.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With