{"id":25487008,"url":"https://github.com/eighty4/cquill","last_synced_at":"2025-04-09T21:14:02.121Z","repository":{"id":117009662,"uuid":"606605784","full_name":"eighty4/cquill","owner":"eighty4","description":"Versioned CQL migrations for Cassandra and ScyllaDB","archived":false,"fork":false,"pushed_at":"2025-02-11T14:57:39.000Z","size":261,"stargazers_count":3,"open_issues_count":2,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-09T21:13:53.805Z","etag":null,"topics":["cassandra","cassandra-cql","cassandra-database","cicd","continuous-delivery","continuous-deployment","continuous-integration","cql","database","database-administration","database-management","database-migrations","database-schema","devops","devops-tools","scylladb"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eighty4.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-26T01:35:53.000Z","updated_at":"2025-02-11T14:57:43.000Z","dependencies_parsed_at":"2023-12-22T02:54:04.688Z","dependency_job_id":"7a6f905c-95fe-4dd1-8d7f-a4bbd7d7ed85","html_url":"https://github.com/eighty4/cquill","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eighty4%2Fcquill","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eighty4%2Fcquill/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eighty4%2Fcquill/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eighty4%2Fcquill/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eighty4","download_url":"https://codeload.github.com/eighty4/cquill/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248111972,"owners_count":21049578,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cassandra","cassandra-cql","cassandra-database","cicd","continuous-delivery","continuous-deployment","continuous-integration","cql","database","database-administration","database-management","database-migrations","database-schema","devops","devops-tools","scylladb"],"created_at":"2025-02-18T19:34:36.806Z","updated_at":"2025-04-09T21:14:02.083Z","avatar_url":"https://github.com/eighty4.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"![CI](https://img.shields.io/github/actions/workflow/status/eighty4/cquill/verify.yml)\n\n# Versioned CQL migrations for Cassandra and ScyllaDB\n\nCreate a directory with CQL files. Develop with Cquill locally. Then version, package and release with Cquill to your database deployment.\n\nVC interest is welcome.\n\n## Migrate command\n\n`cquill migrate` performs a migration using cql sources from the `./cql` directory.\n\nCQL files are versioned with a 3 digit version prefix specified `v001` or `V001` and must be sequentially versioned.\n`v001-create-api-keyspace.cql` is valid while `v8.cql` is not valid.\n\nOn the event of a CQL statement error, Cquill will stop executing statements from the file and report which statement failed.\nRemediation at this point is a manual process and guidance is included with the error message from Cassandra.\n\nMigration history is stored in a table named `cquill.migrated_cql` with a md5 hash record for every completed CQL file.\nFuture migrations will validate previously migrated CQL files against the md5 hashes.\nThis step ensures correctness and prevents a migration that could cause data integrity problems.\n\nUse `cquill help migrate` for parameters.\nThe migration history table's keyspace, name and replication can be configured with the migrate command's parameters.\n\n## Getting started\n\nCquill can be used as a local binary built with Cargo/Rust, a Docker image, or as a Rust library.\n\n### Install locally with Cargo\n\nCargo will build the latest published version of Cquill with install:\n\n```bash\ncargo install cquill\n```\n\nVersions published with Cargo are detailed on [crates.io/crates/cquill](https://crates.io/crates/cquill/versions).\n\n### Run a migration with local CQL sources in a Docker container\n\nImage `84tech/cquill` will migrate CQL sources in its `/cquill/cql` directory (documented in Cquill's [Dockerfile](cquill.install.Dockerfile)).\n\nThis approach requires specifying the `CASSANDRA_NODE` env variable to match Cassandra's hostname and the Docker network:\n\n```bash\ndocker run -it --rm -v $(pwd)/cql:/cquill/cql:ro -e CASSANDRA_NODE=cassandra --network my_network 84tech/cquill migrate\n```\n\n### Create a Docker image of versioned CQL sources\n\nIn a containerized environment using CI/CD automation, versioning CQL to distribute with  release is ideal for workflow\nautomation. Copy the release's CQL sources `./cql` relative to the `WORKDIR`:\n\n```dockerfile\nFROM 84tech/cquill\nWORKDIR /\nCOPY cql cql\n```\n\nGiven a `./cql` directory and a `cql.Dockerfile` build manifest, Docker build a versioned image to be deployed in coordination with the API:\n\n```bash\ndocker build -t my-api-cql:0.0.1 -f cql.Dockerfile .\n```\n\n### Using Cquill as a library\n\nRust projects can embed the Cquill crate into their project to keep an environment's CQL up-to-date as new versions of a\nproject is deployed or run Cquill from unit tests.\n\nThe examples show the [cquill::migrate_cql](/src/lib.rs) API that can be used directly from your Rust project. Check it\nout at [./examples/migrate.rs](/examples/migrate.rs) and run with `cargo run --example migrate`\n\n## Contributing\n\n[Rust](https://rustup.rs/) and [Docker](https://www.docker.com/get-started/) are Cquill's only development dependencies.\n\nUse `docker compose` to launch a Cassandra or ScyllaDB instance for running `cargo test`. Each supported database\nversion is configured in `docker-compose.yml` and the compose service name must be included in the `docker compose up`\ncommand:\n\n```shell\ndocker compose up cassandra_4_1 -d --wait\n```\n\nCI checks on pull requests are detailed in the [verify.yml](.github/workflows/verify.yml) workflow. This workflow runs:\n\n```bash\ncargo fmt\ncargo clippy -- -D warnings\ncargo test\ncargo build --release\n```\n\nThe script `ci_verify.sh` will run all of these CI checks.\n\n## Roadmap\n\nThis is a list of nice-to-have features that I will hope to add in the future:\n\n- `cquill verify` command validates CQL file names, CQL connection, and the md5 hashes of previously migrated CQL files\n- `cquill doctor` command corrects migration history and md5 hashes\n- `cquill dev` command using file watches to drop and recreate keyspaces and tables during active development\n- Support `v001.dev.cql` or similar dev-annotated filenames to populate development environments with data\n- Create an AST for CQL statements, enabling support for several additional features:\n  - rewrite keyspace names for a migration to create parallel deploys of a system's keyspaces (useful for isolated testing)\n  - validate CQL statement syntax before executing against a live database\n  - resolve specific line and column data for CQL statements for command output\n  - invert CQL statements, such as creating an `ALTER TABLE` to drop a column from a statement that creates the column, to revert statements executed before an error prevents a CQL file from completing\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feighty4%2Fcquill","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feighty4%2Fcquill","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feighty4%2Fcquill/lists"}