How to restore same database when switching branch?
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.
- A Linux, Apache, MySQL, PHP (LAMP) stack is a combination of open source software that is typically installed together to enable a server to host dynamic […]
- MySQL is an the most popular open-source database management system, in most of hosting company its has been bundle by LAMP(Linux, Apache, MySQL, PHP/Python/Perl) stack. Another alternative […]
- MySQL is the world’s most popular open-source database. Despite its powerful features, MySQL is simple to set up and easy to use. Below are some instructions […]