hippofish/packages/backend/native-utils/scylla-migration
2023-08-12 23:59:54 -04:00
..
cql/1689400417034_timeline get files and children in scylla 2023-08-12 23:59:54 -04:00
src fix: case sensitive 2023-07-24 03:53:13 -04:00
Cargo.toml feat: scylladb schema migrator 2023-07-16 22:30:30 -04:00
README.md feat: scylladb schema migrator 2023-07-16 22:30:30 -04:00

ScyllaDB Migration Tool

$ cargo run -r -- help
ScyllaDB Migration Tool

Usage: scylla-migration [OPTIONS] <COMMAND>

Commands:
  generate  Generate a new, empty migration
  up        Apply pending migrations
  down      Rollback applied migrations
  help      Print this message or the help of the given subcommand(s)

Options:
  -c, --config <CONFIG>                Path to 'default.yml'
  -d, --migration-dir <MIGRATION_DIR>  Directory to store migration files
  -h, --help                           Print help
  -V, --version                        Print version

CLI Commands

Generate New Migration

cargo run -r -- -d ./cql generate <MIGRATION_NAME>

Edit up.cql and down.cql in scylla-migration/cql/[timestamp]_<MIGRATION_NAME>.

Note: down.cql is for rollback.

Apply all pending migrations

cargo run -r -- -d ./cql -c ../../../.config/default.yml up

Apply first 10 pending migrations

cargo run -r -- -d ./cql -c ../../../.config/default.yml up -n 10

Rollback last applied migrations

cargo run -r -- -d ./cql -c ../../../.config/default.yml down

Rollback last 10 applied migrations

cargo run -r -- -d ./cql -c ../../../.config/default.yml down -n 10