Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Clickhouse Migrations Laravel Package

mavlitov98/clickhouse-migrations

A Laravel package for managing ClickHouse database migrations. Create, run, and roll back schema changes for ClickHouse tables using familiar migration workflows, helping you version your analytics database alongside your application.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Framing correction up front: despite the request's "Laravel/PHP package" label, this is a Symfony bundle. It is a PHP package whose only integration layer is Symfony's bundle system (DI extension, services.yaml, framework-bundle constraints). For a Laravel shop, that distinction is the single most important finding: there is no ServiceProvider, no config/*.php publishable config, and no Artisan commands. Adoption is a fork-and-adapt exercise, not a composer require.

Architecture fit. ClickHouse is an OLAP columnar store, so "migrations" here mean versioned DDL plus backfill orchestration — not the transactional, reversible schema changes Laravel developers expect from php artisan migrate. The package is a reasonable fit if the need is "keep ClickHouse table definitions under version control next to the Laravel application code." It is a poor fit if the implicit expectation is Eloquent-level model/ORM parity with ClickHouse, or transactional rollback. Structurally the package appears to be a thin Symfony wrapper over a clickhouse-migrations core runner plus console commands. Only two things are portable to Laravel: the migration runner core and the Symfony Console command classes (Artisan is itself built on Symfony Console, so those classes can be registered almost directly).

Integration feasibility: medium-to-low. The mechanical work is small — a Laravel service provider binding the runner, plus Artisan command wrappers — but the surrounding risk is not mechanical:

  • Maturity signals are weak. 9 stars, 0 dependents, last release 2023-02-15, composite score 0.175. This is a single-maintainer project with no downstream consumer base to surface bugs or validate upgrades. Treat it as a reference implementation / source drop, not a dependency.
  • ClickHouse DDL is not transactional. down() migrations are best-effort at best; an interrupted ALTER leaves partial state. Any rollback story is a runbook, not a command.
  • Cluster semantics are almost certainly single-node-assuming. ON CLUSTER, ReplicatedMergeTree parameters, and the Distributed DDL queue (system.distributed_ddl_queue) are the hard parts of ClickHouse schema management and are unlikely to be handled in a 9-star bundle from early 2023.
  • No advisory locking. Concurrent deploys can double-apply DDL; compare with Laravel's migrations table lock.
  • Driver/transport coupling. Whether it speaks HTTP or native protocol, and how it handles TLS/auth, determines whether it survives your network policy.
  • Version drift. A Feb-2023 release implies PHP 8.1 / Symfony 6.1–6.2 constraints, which will fight Laravel 11/12 (PHP 8.2+, Symfony 7 components).

Key questions to resolve before committing:

  1. Does the package require symfony/framework-bundle at runtime, or only symfony/console? (Determines whether commands are liftable.)
  2. How is applied state tracked — which table, which engine, and is it idempotent on re-run?
  3. Is ON CLUSTER supported, and does the runner wait on / verify system.distributed_ddl_queue before marking success?
  4. Are Replicated* engine parameters templated per environment, or hardcoded?
  5. Is there any locking, or is concurrent execution undefined behavior?
  6. Which transport (HTTP vs native TCP) and does it support TLS + basic auth + a non-default port?
  7. Is down() implemented as a real inverse DDL, a no-op, or a destructive drop?
  8. Can existing hand-created ClickHouse tables be baselined as already-applied (critical for brownfield adoption)?
  9. What PHP/Symfony version constraints are pinned in composer.json?
  10. Does it support multiple ClickHouse databases/connections in one project?

Integration Approach

Stack fit. Laravel 10/11 on PHP 8.2–8.3 against ClickHouse 23.x/24.x is the target. The honest assessment is that this package occupies roughly 10% of the total integration surface — the versioned-file runner — while the other 90% (connection management, cluster DDL, locking, observability) is work you will do regardless.

Two viable paths, and I would default to the second:

  • Path A — Fork and bridge. Vendor a fork into the repo monorepo, strip the Symfony bundle scaffolding, keep the runner and command classes, and expose them through a small Laravel package: one ServiceProvider, one config file, three Artisan commands (clickhouse:migrate, :status, :make). Feasible in roughly 1–2 engineer-weeks including tests. Only sensible if the core runner genuinely handles cluster DDL — verify with question 3 first.
  • Path B — Spec and build (recommended default). Use the repo as a design reference for file layout and tracking-table shape, then implement an internal command set directly against a maintained ClickHouse client. Same 1–2 engineer-weeks, no abandoned dependency in the deploy path, and you get exactly the DDL semantics your topology requires. The package's value is then architectural precedent, which is real but not a dependency decision.

Migration path (brownfield). Most teams already have ClickHouse tables created by hand or by an analytics engineer. The adoption step is a baseline: insert rows into the tracking table representing the current known-good schema state, so the runner starts cleanly from "now" rather than replaying history. Do not let a tool attempt to reconcile or recreate existing tables — that is how production data gets dropped.

Compatibility. Pin symfony/console to the version Artisan already ships; do not add symfony/framework-bundle to a Laravel app under any circumstances. Confirm the ClickHouse client version aligns with your server version's protocol changes. Vendor the fork (or pin an exact commit) — never a floating Composer constraint against an unmaintained upstream.

Sequencing.

  1. Two-day spike: can the command classes instantiate outside a Symfony kernel, and does the runner emit correct ON CLUSTER SQL for a 2-shard Replicated setup?
  2. Fork + CI: add the fork to the repo, wire a test harness against a ClickHouse container.
  3. Dev / single-node: validate the tracking table, idempotency, and baseline flow.
  4. Staging / cluster: validate Distributed DDL queue waiting, lock behavior, and failure recovery by killing a migration mid-flight.
  5. Production: only with a documented lock mechanism and a rollback runbook that explicitly says "schema changes are forward-only; recovery is a new forward migration."

Keep the two migration regimes strictly separate: Laravel's relational migrations on MySQL/Postgres continue unchanged, with their own tracking table, CI step, and deploy hook. The ClickHouse runner is a second, independent pipeline — do not attempt to interleave them in a single artisan migrate invocation.

Operational Impact

Maintenance. You own this code, fully. Budget ~0.1 FTE steady state for the fork plus ClickHouse schema review. Expect zero upstream commits; the correct posture is to fork once, vendor it, and treat upstream as dormant. The mitigating factor — and it is a genuine one — is that the artifact is small and MIT-licensed, so the exit cost is low. A 2,000-line PHP runner is replaceable; a proprietary migration appliance would not be. That asymmetry is what makes Path A defensible at all.

Support. No vendor, no community (9 stars means effectively no issue triage), no security disclosure process, no signed releases. Supply-chain exposure must be handled by vendoring into your own repo behind your own CI, which also removes the package from your dependency graph for audit purposes. Identify one internal ClickHouse SME as the named owner; there is no external escalation path.

Scaling. Migration runtime scales with cluster fan-out and queue depth, not with PHP throughput. Two hard ceilings to plan around:

  • Distributed DDL is eventually consistent. A command that returns "success" has not necessarily applied everywhere. Any runner that doesn't poll system.distributed_ddl_queue to completion will produce false greens and cross-shard drift.
  • ALTER on large tables is a mutation, not metadata-only, in most cases — it queues work proportional to parts/rows and can run for hours while competing with ingestion. For large changes, prefer create-new-table + EXCHANGE TABLES / RENAME, or partition-level operations, over in-place ALTER. Schedule production migrations in off-peak windows and gate on system.mutations draining.

Failure modes to design against explicitly:

Failure Consequence Mitigation
Migration killed mid-ALTER Partial schema across shards, tracking table out of sync Idempotent DDL (IF NOT EXISTS), manual reconciliation runbook
Concurrent deploys Double-applied DDL, duplicate columns External advisory lock (Redis/DB) around the command
Timeout on cluster DDL False "applied" state Poll DDL queue before recording success
Mutation backlog Ingestion latency, memory pressure, OOM Gate on system.mutations, size changes to off-peak
ZooKeeper session loss Replica divergence Alerting on system.replicas; verify post-run
Driver/protocol mismatch after CH upgrade Runner fails at deploy time Pin client version, test against staging cluster first

Ramp-up. Low for the PHP side — a mid-level Laravel developer can operate the fork within a day. The real cost is ClickHouse operational literacy: 2–3 weeks before an engineer can safely author and reason about cluster DDL, replication parameters, and mutation behavior. Budget that training regardless of whether you adopt, fork, or rebuild this package — it is the dominant cost in the whole initiative and it is entirely independent of the build-vs-buy decision.

Bottom line for a TPM: the package is a useful reference architecture and a plausible fork base, not an adoptable dependency. Approve a two-day spike to answer the cluster-DDL question (question 3), then expect to own the code permanently. The decision is low-regret precisely because the artifact is small and permissively licensed — but scope the effort as "build a ClickHouse migration capability" (2–3 weeks, including ClickHouse ramp-up), never as "install a package."

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel