{"id":29672697,"url":"https://github.com/mikeamputer/clickhouse-migrate","last_synced_at":"2025-07-22T21:07:32.114Z","repository":{"id":303842954,"uuid":"1016137502","full_name":"MikeAmputer/clickhouse-migrate","owner":"MikeAmputer","description":"ClickHouse migrations docker image (WIP)","archived":false,"fork":false,"pushed_at":"2025-07-21T14:31:26.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-21T15:28:21.044Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","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/MikeAmputer.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,"zenodo":null}},"created_at":"2025-07-08T14:43:01.000Z","updated_at":"2025-07-21T14:31:29.000Z","dependencies_parsed_at":"2025-07-10T01:59:34.001Z","dependency_job_id":"a70a37a8-30b5-4b0b-8088-17e83eadd026","html_url":"https://github.com/MikeAmputer/clickhouse-migrate","commit_stats":null,"previous_names":["mikeamputer/clickhouse-migrate"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/MikeAmputer/clickhouse-migrate","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeAmputer%2Fclickhouse-migrate","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeAmputer%2Fclickhouse-migrate/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeAmputer%2Fclickhouse-migrate/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeAmputer%2Fclickhouse-migrate/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MikeAmputer","download_url":"https://codeload.github.com/MikeAmputer/clickhouse-migrate/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MikeAmputer%2Fclickhouse-migrate/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266572882,"owners_count":23950113,"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","status":"online","status_checked_at":"2025-07-22T02:00:09.085Z","response_time":66,"last_error":null,"robots_txt_status":null,"robots_txt_updated_at":null,"robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-07-22T21:07:31.535Z","updated_at":"2025-07-22T21:07:32.099Z","avatar_url":"https://github.com/MikeAmputer.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ch-migrate\n\n[![Docker](https://img.shields.io/badge/docker-ch--migrate-blue?logo=docker)](https://hub.docker.com/r/mikeamputer/ch-migrate)\n[![GHCR](https://img.shields.io/badge/ghcr.io-ch--migrate-blue?logo=github)](https://github.com/MikeAmputer/clickhouse-migrate/pkgs/container/ch-migrate)\n[![License](https://img.shields.io/github/license/MikeAmputer/clickhouse-migrate)](https://github.com/MikeAmputer/clickhouse-migrate/blob/master/LICENSE)\n\nMigrations tool for ClickHouse, distributed as a Docker image. Built on top of the [ClickHouse.Facades](https://github.com/MikeAmputer/ClickHouse.Facades) .NET package, using HTTP client under the hood.\n\n\u003e [!NOTE]\n\u003e This is an unofficial tool and is not affiliated with or endorsed by ClickHouse Inc.\n\u003e \n\u003e \"ClickHouse\" is a registered trademark of ClickHouse Inc. — [clickhouse.com](https://clickhouse.com/)\n\n## Key Features\n- Down migrations support\n- Optional automatic rollback on migration fail\n- HTTPS support\n\n## Usage\nRun the tool using Docker, specifying the desired command (`up` or `down`) and configuration options. The directory containing migration files should be mounted into the container as a volume.\n\n### Commands\n- `up`: Applies all pending migrations in the specified migrations directory.\n- `down \u003cindex\u003e`: Reverts migrations to the specified migration index, rolling back all newer migrations.\n\n### Configuration Options\nThe tool supports configuration via command-line options or environment variables. Command-line options take precedence over environment variables. Boolean command-line arguments can not be used as flags - values should be provided explicitly `--https-enabled=true`.\n\n| Option                | Environment Variable           | Description                                    | Default           |\n|-----------------------|--------------------------------|------------------------------------------------|-------------------|\n| `--host`              | `CH_MIGRATIONS_HOST`           | ClickHouse host.                               | (Required)        |\n| `--port`              | `CH_MIGRATIONS_PORT`           | ClickHouse port.                               | 8123              |\n| `--user`              | `CH_MIGRATIONS_USER`           | ClickHouse user.                               | (Required)        |\n| `--password`          | `CH_MIGRATIONS_PASSWORD`       | ClickHouse password.                           | (Optional)        |\n| `--database`          | `CH_MIGRATIONS_DATABASE`       | ClickHouse database.                           | (Required)        |\n| `--migrations-dir`    | `CH_MIGRATIONS_DIRECTORY`      | Directory containing migration SQL files.      | (Required)        |\n| `--timeout-sec`       | `CH_MIGRATIONS_TIMEOUT`        | Command timeout in seconds.                    | 60                |\n| `--https-enabled`     | `CH_MIGRATIONS_HTTPS_ENABLED`  | Use HTTPS connection (`true`/`false`).         | `false`           |\n| `--rollback-on-fail`  | `CH_MIGRATIONS_ROLLBACK_ON_FAIL` | Automatically rollback on migration failure. | `false`           |\n\n### Migration Files\nMigration files must be placed in the directory specified by `--migrations-dir` (or `CH_MIGRATIONS_DIRECTORY`) and follow a naming convention such as:\n```\n0001_Initial.up.sql\n0001_Initial.down.sql\n```\nEach filename must start with a migration index like `0001_`, followed by migration name (underscores `_` are allowed), suffixed with the migration direction `.up` or `.down`, and ending with the `.sql` file extension. **Down migrations are optional.**\n\n### Quick Setup\n\nbash:\n```bash\ndocker run --rm \\\n  -e CH_MIGRATIONS_HOST=\"example.clickhouse.host\" \\\n  -e CH_MIGRATIONS_PORT=\"8123\" \\\n  -e CH_MIGRATIONS_USER=\"example_user\" \\\n  -e CH_MIGRATIONS_PASSWORD=\"example_password\" \\\n  -e CH_MIGRATIONS_DATABASE=\"example_db\" \\\n  -e CH_MIGRATIONS_DIRECTORY=\"/scripts\" \\\n  -v \"$(pwd)/Migrations:/scripts\" \\\n  mikeamputer/ch-migrate:latest up\n``` \n\nPowerShell:\n```powershell\ndocker run --rm `\n  -e CH_MIGRATIONS_HOST=\"example.clickhouse.host\" `\n  -e CH_MIGRATIONS_PORT=\"8123\" `\n  -e CH_MIGRATIONS_USER=\"example_user\" `\n  -e CH_MIGRATIONS_PASSWORD=\"example_password\" `\n  -e CH_MIGRATIONS_DATABASE=\"example_db\" `\n  -e CH_MIGRATIONS_DIRECTORY=\"/scripts\" `\n  -v \"${PWD}\\Migrations:/scripts\" `\n  mikeamputer/ch-migrate:latest up\n```\n\nDocker Compose:\n```yaml\nch-migrate:\n  image: mikeamputer/ch-migrate:latest\n  environment:\n    - CH_MIGRATIONS_HOST=example.clickhouse.host\n    - CH_MIGRATIONS_PORT=8123\n    - CH_MIGRATIONS_USER=example_user\n    - CH_MIGRATIONS_PASSWORD=example_password\n    - CH_MIGRATIONS_DATABASE=example_db\n    - CH_MIGRATIONS_DIRECTORY=/scripts\n  volumes:\n    - ./Migrations:/scripts\n  command: up\n```\n\n\u003e [!NOTE]\n\u003e `docker-compose` does not support `--rm` (auto-remove) as part of the YAML service definition.\n\u003e\n\u003e For an example using `healthcheck`, see [this docker-compose example](https://github.com/MikeAmputer/clickhouse-migrate/blob/master/examples/Example/docker-compose.yml).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeamputer%2Fclickhouse-migrate","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikeamputer%2Fclickhouse-migrate","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikeamputer%2Fclickhouse-migrate/lists"}