Cappa allows you to quickly snapshot / revert database when you are e.g. writing database migrations, switching branches or messing with SQL.
Warning : not stable yet + PostgreSQL only (at the moment).
Heavily inspired by fastmonkeys/stellar
Cappa allows you to take fast snapshots / restore of your development database.
Usage:
cappa [command]
Available Commands:
back Reinstall a snapshot in development database
delete Delete snapshot
execute Execute sql from file (default '.cappa/execute.sql')
grab Grab backup file (.dump) from s3 bucket
help Help about any command
list List your snapshots
restore Restore from backup file
snap Create snapshot of development database
version Print the version number of Cappa
Flags:
--config string config file (default is .cappa.toml)
-h, --help help for cappa
-v, --verbose What's wrong ? Speak to me
Use "cappa [command] --help" for more information about a command.
Cappa works by storing copies of the database in the RDBMS (named as cappa_xxxx).
When restoring the database, Cappa simply copy the database making it lot faster than the usual SQL dump.
However, Cappa uses lots of storage space so you probably don't want to make too many snapshots or you will eventually run out of storage space.
Warning: Please don't use Cappa if you can't afford data loss. It's great for developing but not meant for production.
Package management is not taking care of for now (will be HomeBrew first).
Download binary (and install in your $PATH)
https://github.com/hbyio/cappa/releases
Cappa looks for a DATABASE_URL
key in your environment variables or in a local .cappa.toml config file.
e.g. : DATABASE_URL=postgres://admin:[email protected]:5432/devdb
$ cappa snapshot
$ cappa restore
$ cappa grab --bucket=safestorage --prefix=database/hourly
$ cappa restore dump
$ cappa execute
(will execute statements in an .cappa/execute.sql, line by line)
Make sure you have the rights to create new databases.
If you are using PostreSQL, make sure you have a database named 'postgres'.
- UX (wait animations, warnings, ..)
- Tests
- Mysql