{"id":19019873,"url":"https://github.com/shini4i/clickhouse-migrations","last_synced_at":"2025-10-06T04:10:33.867Z","repository":{"id":246269294,"uuid":"820593099","full_name":"shini4i/clickhouse-migrations","owner":"shini4i","description":"ClickHouse Migrations CLI","archived":false,"fork":false,"pushed_at":"2024-06-28T19:25:00.000Z","size":203,"stargazers_count":12,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-23T05:51:26.633Z","etag":null,"topics":["automation","clickhouse","clickhouse-migrations","db-migration"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/shini4i.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":"2024-06-26T19:34:43.000Z","updated_at":"2024-12-23T17:41:02.000Z","dependencies_parsed_at":"2025-04-17T09:06:00.333Z","dependency_job_id":null,"html_url":"https://github.com/shini4i/clickhouse-migrations","commit_stats":null,"previous_names":["shini4i/clickhouse-migrations"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/shini4i/clickhouse-migrations","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shini4i%2Fclickhouse-migrations","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shini4i%2Fclickhouse-migrations/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shini4i%2Fclickhouse-migrations/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shini4i%2Fclickhouse-migrations/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shini4i","download_url":"https://codeload.github.com/shini4i/clickhouse-migrations/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shini4i%2Fclickhouse-migrations/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278556719,"owners_count":26006197,"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-10-06T02:00:05.630Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","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":["automation","clickhouse","clickhouse-migrations","db-migration"],"created_at":"2024-11-08T20:14:48.659Z","updated_at":"2025-10-06T04:10:33.833Z","avatar_url":"https://github.com/shini4i.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"https://raw.githubusercontent.com/ClickHouse/clickhouse-js/e88d3eb741d14d907fea2454a56523e876e2ae12/.static/logo.svg\" width=\"200px\" align=\"center\"\u003e\n\n# clickhouse-migrations\n\n\u003ca href=\"https://www.npmjs.com/package/@shini4i/clickhouse-migrations\"\u003e\n\u003cimg alt=\"NPM Version\" src=\"https://img.shields.io/npm/v/%40shini4i%2Fclickhouse-migrations?color=%233178C6\u0026logo=npm\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://www.npmjs.com/package/@shini4i/clickhouse-migrations\"\u003e\n\u003cimg alt=\"NPM Downloads\" src=\"https://img.shields.io/npm/dw/%40shini4i%2Fclickhouse-migrations?color=%233178C6\u0026logo=npm\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://codecov.io/gh/shini4i/clickhouse-migrations\"\u003e\n\u003cimg alt=\"CodeCov coverage\" src=\"https://codecov.io/gh/shini4i/clickhouse-migrations/graph/badge.svg?token=8QWRD6EAQJ\"\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/shini4i/clickhouse-migrations/blob/main/LICENSE\"\u003e\n\u003cimg alt=\"Project LICENSE\" src=\"https://img.shields.io/github/license/shini4i/clickhouse-migrations\"\u003e\n\u003c/a\u003e\n\n\u003c/div\u003e\n\n## Install\n\n```sh\nnpm install -g @shini4i/clickhouse-migrations\n```\n\n## Usage\n\nCreate a directory, where migrations will be stored. It will be used as the value for the `--migrations-home` option (or for environment variable `CH_MIGRATIONS_HOME`).\n\nIn the directory, create migration files, which should be named like this: `01_some_text.sql`, `02_other_text.sql`, `10_more_test.sql`. What's important here is that the migration version number should come first, followed by an underscore (`_`), and then any text can follow. The version number should increase for every next migration. Please note that once a migration file has been applied to the database, it cannot be modified or removed. \n\nFor migrations' content should be used correct SQL ClickHouse queries. Multiple queries can be used in a single migration file, and each query should be terminated with a semicolon (;). The queries could be idempotent - for example: `CREATE TABLE IF NOT EXISTS table ...;` Clickhouse settings, that can be included at the query level, can be added like `SET allow_experimental_object_type = 1;`. For adding comments should be used `--`, `# `, `#!`. \n\nIf the database provided in the `--db` option (or in `CH_MIGRATIONS_DB`) doesn't exist, it will be created automatically.\n\n```\n  Usage\n    $ clickhouse-migrations migrate \u003coptions\u003e\n\n  Required flags\n      --url=\u003curl\u003e                       Clickhouse URL (ex. https://clickhouse:8123)\n      --user=\u003cname\u003e                     Username\n      --db=\u003cname\u003e                       Database name\n      --migrations-home=\u003cdir\u003e           Migrations' directory\n      \n  Optional flags\n      --password=\u003cpassword\u003e             Password\n      --engine=\u003cengine\u003e                 The engine to use for DB creation\n      --request-timeout=\u003cmilliseconds\u003e  Request timeout in milliseconds\n    \n  Environment variables\n      Instead of options can be used environment variables.\n      CH_MIGRATIONS_URL                 Clickhouse hostname (--url)\n      CH_MIGRATIONS_USER                Username (--user)\n      CH_MIGRATIONS_PASSWORD            Password (--password)\n      CH_MIGRATIONS_DB                  Database name (--db)\n      CH_MIGRATIONS_HOME                Migrations' directory (--migrations-home)\n      CH_MIGRATIONS_ENGINE              The engine to use for DB creation (optional)\n      CH_MIGRATIONS_REQUEST_TIMEOUT     Clickhouse client request timeout (optional)\n\n  CLI examples\n      clickhouse-migrations migrate --url=http://localhost:8123 \n      --user=default --db=analytics \n      --migrations-home=/app/clickhouse/migrations\n\n      clickhouse-migrations migrate \n```\n\nMigration file example:\n```\n-- an example of migration file 01_init.sql\n\nSET allow_experimental_object_type = 1;\n\nCREATE TABLE IF NOT EXISTS events (\n  event JSON\n);\n```\n\n## Acknowledgements\n\nThis project is a fork of [clickhouse-migrations](https://github.com/VVVi/clickhouse-migrations), originally developed by [VVVi](https://github.com/VVVi).\n\n## Contributing\n\nPull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshini4i%2Fclickhouse-migrations","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshini4i%2Fclickhouse-migrations","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshini4i%2Fclickhouse-migrations/lists"}