-
Notifications
You must be signed in to change notification settings - Fork 4
Home
DBGit is intended for support of DB development processes and methods as close to those of Git as possible:
- easy-to-create sandboxes, individual for each developer;
- new branches for new features/fixes;
- CI/CD, and others.
Similar to Git, you can switch between commits as needed, and get the consistent DB state, including table structure and records, views, functions and other db objects. DB migrations between commits are automatic.
DBGit supports Oracle, PostgreSQL, and is intended to support other DBMS in the future. It even provides cross-DBMS features to some extent: you can migrate table structure and data between different DBMSs, if needed.
Install or build from sources DBGit.
First thing you need is a local Git repository, which you create as you would do it with Git:
- clone an existing remote repository locally:
dbgit clone https://login:password@example.com/repo.git
- create an empty local repository and bind it with the remote one:
dbgit init
dbgit remote add origin https://login:password@example.com/repo.git
Then to bind the repository with DB you need to run dbgit link
with command like this:
dbgit link jdbc:oracle:thin:@192.168.1.1:1521:SCHEME user=username password=pass
dbgit
is ready to use!
If you are using Oracle Database, make sure your Oracle user have grants to next tables:
- DBA_ROLE_PRIVS
- DBA_OBJECTS
- DBA_SEQUENCES
- DBA_TABLES
- DBA_TAB_COLS
- DBA_USERS
- DBA_SEGMENTS
These are common Dbgit commands used in various situations:
clone | clone a repository into a new directory |
init | create an empty Git repository or reinitialize an existing one |
link | establishes connection with database |
synonym | specifies synonym for db scheme |
remote | let you bind your local repository with remote repository |
config | Lets you configure dbgit |
status | shows current status of db objects |
add | adds db objects into the dbgit index |
reset | reset current HEAD to the specified state |
rm | removes objects from the dbgit index |
restore | restores db from the dbgit repository |
dump | dumps db objects into the dbgit repository |
valid | checks if dbgit data files are valid |
checkout | switch branches or restore working tree files |
commit | makes git commit |
merge | join two or more development histories together |
pull | fetch from and integrate with another repository or a local branch |
push | update remote refs along with associated objects |
fetch | download objects and refs from another repository |
Getting started
Building
Reference