{"_id":"@aragornhq/ch-migration","_rev":"6-bac6a7779c37fd795d4946947eb339ad","name":"@aragornhq/ch-migration","dist-tags":{"latest":"1.1.3"},"versions":{"1.0.8":{"name":"@aragornhq/ch-migration","version":"1.0.8","keywords":["clickhouse","migration","typescript","cli","rollback"],"author":{"name":"Aragorn AI"},"license":"MIT","_id":"@aragornhq/ch-migration@1.0.8","maintainers":[{"name":"aragornhq","email":"edward.adjei@aragorn.ai"}],"homepage":"https://github.com/aragornhq/ch-migration#readme","bugs":{"url":"https://github.com/aragornhq/ch-migration/issues"},"bin":{"ch-migrate":"dist/cli.js"},"dist":{"shasum":"34fcdae25b238f2fe4cd525e96c58c9fec88eef1","tarball":"https://registry.npmjs.org/@aragornhq/ch-migration/-/ch-migration-1.0.8.tgz","fileCount":24,"integrity":"sha512-XvcYLDK8WTHCfHKkQJ4zcnijOORiYSS4levLGz1ojXKaBnzMdEwryWuitrgrXzGGL2TWDCGhK+wt1tpAZ0bJRA==","signatures":[{"sig":"MEQCIDZvXgQ4H+0zEJazOAi7LXsrgE73tmHEYWELwVbfxm1pAiBIFDHieH4imj/MfQeGl8t/gqTtt7dPM3EAUAsh2gAxVw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31525},"main":"dist/cli.js","types":"dist/cli.d.ts","gitHead":"af6361ba83ef47174b64a1e3f2c641d7a316bd91","scripts":{"dump":"ts-node src/cli.ts dump","test":"jest","build":"tsc","migration:up":"ts-node src/cli.ts migration:up","migration:down":"ts-node src/cli.ts migration:down","migration:create":"ts-node src/cli.ts migration:create"},"_npmUser":{"name":"aragornhq","email":"edward.adjei@aragorn.ai"},"repository":{"url":"git+https://github.com/aragornhq/ch-migration.git","type":"git"},"_npmVersion":"10.8.2","description":"Production-grade ClickHouse migration CLI with rollback, test coverage, and GitHub Actions support","directories":{},"_nodeVersion":"20.19.4","dependencies":{"@clickhouse/client":"^1.11.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.3.4","ts-node":"^10.0.0","typescript":"^5.0.0","@types/jest":"^29.5.14"},"_npmOperationalInternal":{"tmp":"tmp/ch-migration_1.0.8_1756001153177_0.29483259309052734","host":"s3://npm-registry-packages-npm-production"}},"1.0.9":{"name":"@aragornhq/ch-migration","version":"1.0.9","keywords":["clickhouse","migration","typescript","cli","rollback"],"author":{"name":"Aragorn AI"},"license":"MIT","_id":"@aragornhq/ch-migration@1.0.9","maintainers":[{"name":"aragornhq","email":"edward.adjei@aragorn.ai"}],"homepage":"https://github.com/aragornhq/ch-migration#readme","bugs":{"url":"https://github.com/aragornhq/ch-migration/issues"},"bin":{"ch-migrate":"dist/cli.js"},"dist":{"shasum":"a6e4357ef9e2437271fada6465d94a18bc19e783","tarball":"https://registry.npmjs.org/@aragornhq/ch-migration/-/ch-migration-1.0.9.tgz","fileCount":24,"integrity":"sha512-wRUjnA6bmSZ8TDPrslCb9/HDpi5PldfIeg9zlcIbbUFF/hyrGFb/Qp32EKm7hrnzKIlmxJ/UIoSLmq7AAIOGJg==","signatures":[{"sig":"MEYCIQDLvL0TJalKR/y3LaF8E6+MBeW/RH+bG9dZLgSyrVuDqAIhAPu+wc7YLRMNtnvn2lSZ7sS5u3LVkkFojEGcg4oRPbBR","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31403},"main":"dist/cli.js","types":"dist/cli.d.ts","gitHead":"58153c6350c57d28393285058324df35abd1fe52","scripts":{"dump":"ts-node src/cli.ts dump","test":"jest","build":"tsc","migration:up":"ts-node src/cli.ts migration:up","migration:down":"ts-node src/cli.ts migration:down","migration:create":"ts-node src/cli.ts migration:create"},"_npmUser":{"name":"aragornhq","email":"edward.adjei@aragorn.ai"},"repository":{"url":"git+https://github.com/aragornhq/ch-migration.git","type":"git"},"_npmVersion":"10.8.2","description":"Production-grade ClickHouse migration CLI with rollback, test coverage, and GitHub Actions support","directories":{},"_nodeVersion":"20.19.4","dependencies":{"@clickhouse/client":"^1.11.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.3.4","ts-node":"^10.0.0","typescript":"^5.0.0","@types/jest":"^29.5.14"},"_npmOperationalInternal":{"tmp":"tmp/ch-migration_1.0.9_1756002403935_0.4358073046674513","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@aragornhq/ch-migration","version":"1.1.0","keywords":["clickhouse","migration","typescript","cli","rollback"],"author":{"name":"Aragorn AI"},"license":"MIT","_id":"@aragornhq/ch-migration@1.1.0","maintainers":[{"name":"aragornhq","email":"edward.adjei@aragorn.ai"}],"homepage":"https://github.com/aragornhq/ch-migration#readme","bugs":{"url":"https://github.com/aragornhq/ch-migration/issues"},"bin":{"ch-migrate":"dist/cli.js"},"dist":{"shasum":"53e0f8d531763d62112e46d8e7d7b635ad1fe797","tarball":"https://registry.npmjs.org/@aragornhq/ch-migration/-/ch-migration-1.1.0.tgz","fileCount":24,"integrity":"sha512-s9Xr8HIDIOgapPx5Sr2A1h0pR9LtnD/8NhSS0hL4Y6OSVTeaLmo2LRaLuYyTe2eljaM53jPT7oM7FcJpxASDSw==","signatures":[{"sig":"MEUCIEBhAuK/AzVA1k9gV4+u7+1/cfZiaNFQAy4f2MmrcJVmAiEAtVoHMA3YzJqV+H6w5xPHc1WDXEJpnk3vB8EOght9jFM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31512},"main":"dist/cli.js","types":"dist/cli.d.ts","gitHead":"993282e176708253434fb64ec5ca381564fde8a9","scripts":{"dump":"ts-node src/cli.ts dump","test":"jest","build":"tsc","migration:up":"ts-node src/cli.ts migration:up","migration:down":"ts-node src/cli.ts migration:down","migration:create":"ts-node src/cli.ts migration:create"},"_npmUser":{"name":"aragornhq","email":"edward.adjei@aragorn.ai"},"repository":{"url":"git+https://github.com/aragornhq/ch-migration.git","type":"git"},"_npmVersion":"10.8.2","description":"Production-grade ClickHouse migration CLI with rollback, test coverage, and GitHub Actions support","directories":{},"_nodeVersion":"20.19.4","dependencies":{"@clickhouse/client":"^1.11.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.3.4","ts-node":"^10.0.0","typescript":"^5.0.0","@types/jest":"^29.5.14"},"_npmOperationalInternal":{"tmp":"tmp/ch-migration_1.1.0_1756002831377_0.9512136382114011","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@aragornhq/ch-migration","version":"1.1.1","keywords":["clickhouse","migration","typescript","cli","rollback"],"author":{"name":"Aragorn AI"},"license":"MIT","_id":"@aragornhq/ch-migration@1.1.1","maintainers":[{"name":"aragornhq","email":"edward.adjei@aragorn.ai"}],"homepage":"https://github.com/aragornhq/ch-migration#readme","bugs":{"url":"https://github.com/aragornhq/ch-migration/issues"},"bin":{"ch-migrate":"dist/cli.js"},"dist":{"shasum":"beca1845f47d904801a2e05c20ac627622b8ca9d","tarball":"https://registry.npmjs.org/@aragornhq/ch-migration/-/ch-migration-1.1.1.tgz","fileCount":24,"integrity":"sha512-ADBgq257NETBbGJbAXmnEzLw9229JNGDrqlSUI5FSnJPvkm3dxI9heFlXEv0W4EV+3avqbxkZtDHyiC2WAgp9g==","signatures":[{"sig":"MEUCIQC4JE6UpdNXy9s9VlMPAFZwMBnp51oMAWlQTHfh4pLIhgIgZ11rGCYjI/GOkARsk9y17TitINPhN1PvkTt/Ittk/gc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31562},"main":"dist/cli.js","types":"dist/cli.d.ts","gitHead":"9ea7c6724b5e0bda4b0815dc64f77bca828e5cd5","scripts":{"dump":"ts-node src/cli.ts dump","test":"jest","build":"tsc","migration:up":"ts-node src/cli.ts migration:up","migration:down":"ts-node src/cli.ts migration:down","migration:create":"ts-node src/cli.ts migration:create"},"_npmUser":{"name":"aragornhq","email":"edward.adjei@aragorn.ai"},"repository":{"url":"git+https://github.com/aragornhq/ch-migration.git","type":"git"},"_npmVersion":"10.8.2","description":"Production-grade ClickHouse migration CLI with rollback, test coverage, and GitHub Actions support","directories":{},"_nodeVersion":"20.19.4","dependencies":{"@clickhouse/client":"^1.11.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.3.4","ts-node":"^10.0.0","typescript":"^5.0.0","@types/jest":"^29.5.14"},"_npmOperationalInternal":{"tmp":"tmp/ch-migration_1.1.1_1756004374209_0.2029747843139169","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@aragornhq/ch-migration","version":"1.1.2","keywords":["clickhouse","migration","typescript","cli","rollback"],"author":{"name":"Aragorn AI"},"license":"MIT","_id":"@aragornhq/ch-migration@1.1.2","maintainers":[{"name":"aragornhq","email":"edward.adjei@aragorn.ai"}],"homepage":"https://github.com/aragornhq/ch-migration#readme","bugs":{"url":"https://github.com/aragornhq/ch-migration/issues"},"bin":{"ch-migrate":"dist/cli.js"},"dist":{"shasum":"2dacd0c606b5abed64c7c05bc4bd4bd347875604","tarball":"https://registry.npmjs.org/@aragornhq/ch-migration/-/ch-migration-1.1.2.tgz","fileCount":24,"integrity":"sha512-5IZDwcJN7egX+Hfuu7RY2jKY+xH8mYA2/MI8rKdxVmmEHh8/+pt3+8bGMG07QZz8xR24mWPz/bbiGsX1YGntzA==","signatures":[{"sig":"MEQCIAv+o0xwMw9r4TSccoK+5jtty1re0WAJjY7iey1NWPNcAiBqCmRMemHhJj/1B4iWU3uwy+YnVKhbZOeHKGHO/ikD1A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":35438},"main":"dist/cli.js","types":"dist/cli.d.ts","gitHead":"72d21edc8d5c9e31cc9a50a5d5b9819c756427e3","scripts":{"dump":"ts-node src/cli.ts dump","test":"jest","build":"tsc","migration:up":"ts-node src/cli.ts migration:up","migration:down":"ts-node src/cli.ts migration:down","migration:create":"ts-node src/cli.ts migration:create"},"_npmUser":{"name":"aragornhq","email":"edward.adjei@aragorn.ai"},"repository":{"url":"git+https://github.com/aragornhq/ch-migration.git","type":"git"},"_npmVersion":"10.8.2","description":"Production-grade ClickHouse migration CLI with rollback, test coverage, and GitHub Actions support","directories":{},"_nodeVersion":"20.19.4","dependencies":{"@clickhouse/client":"^1.11.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","ts-jest":"^29.3.4","ts-node":"^10.0.0","typescript":"^5.0.0","@types/jest":"^29.5.14"},"_npmOperationalInternal":{"tmp":"tmp/ch-migration_1.1.2_1756173172981_0.17218036046485086","host":"s3://npm-registry-packages-npm-production"}},"1.1.3":{"name":"@aragornhq/ch-migration","version":"1.1.3","description":"Production-grade ClickHouse migration CLI with rollback, test coverage, and GitHub Actions support","repository":{"type":"git","url":"git+https://github.com/aragornhq/ch-migration.git"},"homepage":"https://github.com/aragornhq/ch-migration#readme","bugs":{"url":"https://github.com/aragornhq/ch-migration/issues"},"main":"dist/cli.js","types":"dist/cli.d.ts","bin":{"ch-migrate":"dist/cli.js"},"scripts":{"build":"tsc","migration:create":"ts-node src/cli.ts migration:create","migration:up":"ts-node src/cli.ts migration:up","migration:down":"ts-node src/cli.ts migration:down","dump":"ts-node src/cli.ts dump","test":"jest"},"keywords":["clickhouse","migration","typescript","cli","rollback"],"author":{"name":"Aragorn AI"},"license":"MIT","dependencies":{"@clickhouse/client":"^1.11.1"},"devDependencies":{"@types/jest":"^29.5.14","jest":"^29.7.0","ts-jest":"^29.3.4","ts-node":"^10.0.0","typescript":"^5.0.0"},"publishConfig":{"access":"public"},"_id":"@aragornhq/ch-migration@1.1.3","gitHead":"1187681b5d036641c32e431ad6baae9a877def98","_nodeVersion":"20.20.0","_npmVersion":"10.8.2","dist":{"integrity":"sha512-CBE+OT8og/EuNZL9JgWyiCcHRxehRtKSTLB6C3PQ8npkHX7lVoSahz3pl3N9clQvoy3iKCEIzfheuWefQdYaTg==","shasum":"44fa22cb475dc96aa5d4ec53a49c09f2026e5eb0","tarball":"https://registry.npmjs.org/@aragornhq/ch-migration/-/ch-migration-1.1.3.tgz","fileCount":25,"unpackedSize":49427,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIBPv5tCd3NBxEcwf9nN5FAjwskH+cPDZGIlhYbPdoQeUAiEAoUsJvRvopqVbQ6k0ulU7XuKo3iGDpElRQzIRise3it8="}]},"_npmUser":{"name":"aragornhq","email":"edward.adjei@aragorn.ai"},"directories":{},"maintainers":[{"name":"aragornhq","email":"edward.adjei@aragorn.ai"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ch-migration_1.1.3_1769736809256_0.615340311235004"},"_hasShrinkwrap":false}},"time":{"created":"2025-08-24T02:05:53.059Z","modified":"2026-01-30T01:33:29.553Z","1.0.8":"2025-08-24T02:05:53.372Z","1.0.9":"2025-08-24T02:26:44.121Z","1.1.0":"2025-08-24T02:33:51.546Z","1.1.1":"2025-08-24T02:59:34.408Z","1.1.2":"2025-08-26T01:52:53.180Z","1.1.3":"2026-01-30T01:33:29.441Z"},"bugs":{"url":"https://github.com/aragornhq/ch-migration/issues"},"author":{"name":"Aragorn AI"},"license":"MIT","homepage":"https://github.com/aragornhq/ch-migration#readme","keywords":["clickhouse","migration","typescript","cli","rollback"],"repository":{"type":"git","url":"git+https://github.com/aragornhq/ch-migration.git"},"description":"Production-grade ClickHouse migration CLI with rollback, test coverage, and GitHub Actions support","maintainers":[{"name":"aragornhq","email":"edward.adjei@aragorn.ai"}],"readme":"# @aragornhq/ch-migration\n\n> ⚔️ Production-grade CLI for managing ClickHouse schema migrations with raw SQL, rollback, integrity tracking, strict mode, and GitHub automation.\n\n---\n\n## 🚀 Features\n\n- ✅ Native [ClickHouse](https://clickhouse.com/) support using [`@clickhouse/client`](https://www.npmjs.com/package/@clickhouse/client)\n- ✅ Fully typed CLI (TypeScript)\n- ✅ Supports `migration:create`, `migration:up`, `migration:down`, `dump`\n- ✅ Optional dry run to validate migrations without applying them\n- ✅ Rollback support using `-- ROLLBACK BELOW --` separator\n- ✅ SHA-256 hash tracking for applied migrations\n- ✅ Supports multiple SQL statements per migration section with ordered rollback\n- ✅ Optional config via `ch-migration.json`\n- ✅ `${CH_CLUSTER}` placeholder replaced with the `CH_CLUSTER` environment variable\n- ✅ Uses `ReplicatedReplacingMergeTree` for migration tracking when `CH_CLUSTER` is set\n- ✅ Validates `CREATE TABLE` migrations use `ON CLUSTER` with a `Replicated` engine when `CH_CLUSTER` is set\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install --save-dev @aragornhq/ch-migration\n```\n\n## 🔧 Setup\n\n1. Set the ClickHouse connection using environment variables (prefixed with `CH_`):\n\n```bash\nCH_HOST=localhost\nCH_PORT=8123\nCH_DB=default\nCH_USER=default\nCH_PASSWORD=\n# set to \"true\" when using HTTPS\nCH_USE_TLS=false\n# optional: set cluster name for `${CH_CLUSTER}`\nCH_CLUSTER=\n```\n\n2. Specify where your migration files live via a `ch-migration.json` file:\n\n```json\n{\n  \"path\": \"db/migrations\"\n}\n```\n\nCreate the folder if it does not already exist.\n\n## 🛠️ Usage\n\nRun the CLI with `npx` or via an npm script. The executable name is `ch-migrate`:\n\n```bash\nnpx ch-migrate <command> [options]\n```\n\n### Commands\n\n- `migration:create <name> --path=<folder>` – create a timestamped migration file. The `--path` option is optional when the path is defined in `ch-migration.json`.\n- `migration:up --path=<folder> [--dry-run]` – apply all pending migrations. Use `--dry-run` to preview without applying.\n- `migration:down --file=<filename.sql> --path=<folder>` – roll back a single migration.\n- `dump --out=<file>` – export `CREATE` statements for all tables in the current database. Each statement includes `IF NOT EXISTS` and no `DROP` statements so rerunning is safe.\n\nEach file should contain your SQL up statements followed by `-- ROLLBACK BELOW --` and the down statements. Statements are executed in order; rollbacks run in reverse order.\n\n```sql\n-- 20250101_create_table.sql\nCREATE TABLE example (id UInt8) ENGINE = MergeTree;\nINSERT INTO example VALUES (1);\n\n-- ROLLBACK BELOW --\nDELETE FROM example WHERE id = 1;\nDROP TABLE example;\n```\n\nApplied migrations are recorded in a `migrations` table together with a SHA‑256 hash. If a hash changes, the run fails to prevent drift.\n","readmeFilename":"README.md"}