Usually database's functions and procedures are not version controlled. This ruby scrips provides a simple way to backup them in text files.
- Install dbi :
gem install dbi
- Edit
env.rb
file with your DB environment. - Run
ruby sp_backup.rb
to backup stored procedures,ruby fn_backup.rb
to backup functions.
- Add version control to backup directory.
- Register a job schedule(Jenkins etc). Running scripts and commit to version control.
- Oracle only : Working on Oracle DBMS for now.
- 2 environments : PROD, DEV. Will make it more flexible if needed.