- manage db config in one place
- use favored command tools eg. pgcli, psql, sequel
- connect as easy as possible
- write sqlets(db script) quickly
- make test and run easily
- try and learn advanced db knowledge
- config
~/.dbs.yml
(orDBSFILE
env) assample-dbs.yml
- install ruby locally eg.
brew install ruby
- install pg locally eg.
brew install [email protected]
- run
bundle install
- put
source /path/to/here/dba.rc
in your~/.bashrc
run like below:
dbcli help
dbmigrate help
pga help
rake demo
sql/demo.rb
rspec spec/try_db_spec.rb
dockerdba down # get image
# config ~/.dbs.yml with a docker_test db item
dockerdba try
# write your scripts by dockerdba/try.sh
pga gen_datafile postgres://xxx/to_staging_db
生成大表过滤规则文件(如.datafiles/starup.pg.staging.localdomain.5432.yml
), 可自行编辑该规则文件pga copy postgres://src_staging_db_url/db1 postgres://localhost/new_not_exist_db1 --dryrun
生成shell脚本,去掉--dryrun可立即触发执行。可自行定制生产的shell脚本