{"id":28965990,"url":"https://github.com/devflowinc/clickhouse-migrations","last_synced_at":"2025-06-24T07:10:47.828Z","repository":{"id":247864830,"uuid":"826916708","full_name":"devflowinc/clickhouse-migrations","owner":"devflowinc","description":"ClickHouse schema migration utility for Rust","archived":false,"fork":false,"pushed_at":"2025-04-10T03:08:26.000Z","size":44,"stargazers_count":9,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-06-22T05:17:05.227Z","etag":null,"topics":[],"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/devflowinc.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2024-07-10T16:30:29.000Z","updated_at":"2025-05-01T17:10:27.000Z","dependencies_parsed_at":"2024-08-22T02:45:50.760Z","dependency_job_id":null,"html_url":"https://github.com/devflowinc/clickhouse-migrations","commit_stats":null,"previous_names":["devflowinc/ch-migrations"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/devflowinc/clickhouse-migrations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devflowinc%2Fclickhouse-migrations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devflowinc%2Fclickhouse-migrations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devflowinc%2Fclickhouse-migrations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devflowinc%2Fclickhouse-migrations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devflowinc","download_url":"https://codeload.github.com/devflowinc/clickhouse-migrations/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devflowinc%2Fclickhouse-migrations/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261624969,"owners_count":23186121,"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":[],"created_at":"2025-06-24T07:10:46.550Z","updated_at":"2025-06-24T07:10:47.812Z","avatar_url":"https://github.com/devflowinc.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Clickhouse Migration Tool (chm) - README\n\n## Overview\n\nThe 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.\n\n## Installation\n\nTo 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:\n\n```sh\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n```\n\nThen, you can install trieve from cargo:\n\n```sh\ncargo install chm\n```\n\nAfter installing the tool, you can run the CLI using the `chm` command.\n\n## Usage\n\n### General Structure\n\n```sh\nchm \u003ccommand\u003e [subcommand] [flags]\n```\n\n### Commands and Subcommands\n\n#### Setup\n\nInitial 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.\n\n```sh\nchm setup --url \u003cCLICKHOUSE_URL\u003e --user \u003cCLICKHOUSE_USER\u003e --password \u003cCLICKHOUSE_PASSWORD\u003e --database \u003cCLICKHOUSE_DB\u003e\n```\n\n- `--url` (Optional): Clickhouse URL. Will look for `CLICKHOUSE_URL` environment variable if not provided.\n- `--user` (Optional): Clickhouse user. Will look for `CLICKHOUSE_USER` environment variable if not provided.\n- `--password` (Optional): Clickhouse password. Will look for `CLICKHOUSE_PASSWORD` environment variable if not provided.\n- `--database` (Optional): Clickhouse database. Will look for `CLICKHOUSE_DB` environment variable if not provided.\n\n#### Migration\n\nCommands to handle migration operations.\n\n##### Generate\n\nGenerates a new migration file with the specified name.\n\n```sh\nchm migration generate \u003cMIGRATION_NAME\u003e\n```\n\n##### Run\n\nIdentifies and runs pending migrations.\n\n```sh\nchm migration run\n```\n\n##### Redo\n\nReverts the latest migration and applies it again.\n\n```sh\nchm migration redo\n```\n\n##### Revert\n\nReverts the last migration.\n\n```sh\nchm migration revert\n```\n\n## Example\n\n1. **Setup the Migration Tool**\n\n   ```sh\n   chm setup --url http://localhost:8123 --user default --password password --database my_database\n   ```\n\n2. **Generate a New Migration**\n\n   ```sh\n   chm migration generate create_users_table\n   ```\n\n3. **Run Pending Migrations**\n\n   ```sh\n   chm migration run\n   ```\n\n4. **Redo the Latest Migration**\n\n   ```sh\n   chm migration redo\n   ```\n\n5. **Revert the Last Migration**\n\n   ```sh\n   chm migration revert\n   ```\n\n## Contributing\n\nContributions are welcome! Please fork the repository and submit a pull request with your changes.\n\n## License\n\nThis project is licensed under the MIT License. See the LICENSE file for details.\n\n## Contact\n\nFor any questions or issues, please open an issue on the GitHub repository or contact the maintainers.\n\n---\n\nThis 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 \u003ccommand\u003e --help`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevflowinc%2Fclickhouse-migrations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevflowinc%2Fclickhouse-migrations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevflowinc%2Fclickhouse-migrations/lists"}