Database version control for developers!
It is designed based on git VCS, but for Postgres Databases.
Alike Git, which saves the snapshot of the file changed, this saves the snapshot of database(To be optimized, save yourselves a lot of disk space for now please!) whenever you branch.
- Java 7 or above, install with Homebrew by following
brew tap caskroom/versions
brew cask install java8
-
Postgres (Tested in version v9.3)
-
DB server,can be started with
pg_ctl start
after installation of Postgres. -
Also,
pg_dump
andpsql
must be available on thePATH
of the current terminal tab.
Go to the required directory and type in
mkdir dbgit
, creates a directory for dbgit. All the version control related data are saved in this folder.brew install wget
, Installs wget using Homebrew.wget https://github.com/mohamedanees6/dbGit/raw/master/src/main/dbGit.jar
, Downloads dbGit.jar from Github! to current repository- Paste the following line to your
~/.bash_profile
.alias dbgit="java -jar dbGit.jar"
source ~/.bash_profile
to reload the configured alias in current tab.
To verify everything is working fine,type in dbgit and you must get the help content.
This creates branch(snapshot) of a particular database.
dbgit init <address:port> <db_name> <db_user_name> <db_password> <branch_name>
Example: dbgit init localhost:5432 mytestdb postgres mypass123 mybranch1
If there is no password, the same command reads as dbgit init localhost:5432 mydb postgres null mybranch1
Here mybranch1
is the name of the branch created from the database mydb
.
This check out the database data to the branch(snapshot) as described by the branch name of the database.
dbgit checkout <address:port> <db_name> <db_user_name> <db_password> <branch_name>
Example: dbgit checkout localhost:5432 mytestdb postgres mypass123 mybranch
Drop available branch to a database
dbgit drop <address:port> <db_name> <db_user_name> <db_password> <branch_name>
Example : dbgit drop localhost:5432 mytestdb postgres mypass123 mybranch
View all available branches to a database
dbgit view <address:port> <db_name> <db_user_name> <db_password>
Example: dbgit view localhost:5432 mytestdb postgres mypass123
Type in dbgit help
to display the Help content.
This is initial commit of an idea(After so much frustation of non-availability of version control!) and I welcome suggestions, please drop mail at mailto:[email protected].
Please have a backup of the database handy in some secure folder. This is entitled only for development in local machine and not for production use.
தமிழனின் படைப்பு, ಕರ್ನಾಟಕದಿಂದ! 💙💙