Clickhouse Migration Tool (chm) - README
Overview
The Clickhouse Migration Tool (chm) is a command-line interface (CLI) designed to help manage database migrations for Clickhouse. It allows users to set up migration configurations, generate new migrations, and run migrations in a stateful manner.
Installation
To install the Clickhouse Migration Tool, you need to have Rust installed on your machine. If you don't already have it installed, you can install it with:
|
Then, you can install trieve from cargo:
After installing the tool, you can run the CLI using the chm command.
Usage
General Structure
Commands and Subcommands
Setup
Initial setup of the migration tool. This command creates a folder to contain migrations and a .toml file with connection details. It will error if the migrations folder already exists.
--url(Optional): Clickhouse URL. Will look forCLICKHOUSE_URLenvironment variable if not provided.--user(Optional): Clickhouse user. Will look forCLICKHOUSE_USERenvironment variable if not provided.--password(Optional): Clickhouse password. Will look forCLICKHOUSE_PASSWORDenvironment variable if not provided.--database(Optional): Clickhouse database. Will look forCLICKHOUSE_DBenvironment variable if not provided.
Migration
Commands to handle migration operations.
Generate
Generates a new migration file with the specified name.
Run
Identifies and runs pending migrations.
Redo
Reverts the latest migration and applies it again.
Revert
Reverts the last migration.
Example
-
Setup the Migration Tool
-
Generate a New Migration
-
Run Pending Migrations
-
Redo the Latest Migration
-
Revert the Last Migration
Contributing
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
License
This project is licensed under the MIT License. See the LICENSE file for details.
Contact
For any questions or issues, please open an issue on the GitHub repository or contact the maintainers.
This README provides a basic overview of the Clickhouse Migration Tool and its features. For detailed usage and examples, please refer to the command-specific help by running chm <command> --help.