- How do I install clickhouse-migrations in a Laravel project?
- Install it with Composer using composer require mavlitov98/clickhouse-migrations, then confirm the command registration is compatible with your Laravel version. The package adds Artisan migration commands and a dedicated ClickHouse connection, so you also add ClickHouse credentials in your database configuration. Because the last release dates to early 2023, review the composer.json constraints before installing into a modern Laravel 11 or 12 application.
- Does this package support Laravel 10 and Laravel 11?
- The package targets Laravel's Artisan migration workflow, so it is intended to run on supported Laravel versions. However, the 2023-era release may pin older Illuminate or Symfony component constraints that can conflict with Laravel 10 or 11 on PHP 8.2 and newer. Check composer.json requirements first and test the install on a branch before adopting it for production.
- How do I create a new ClickHouse migration with this package?
- You create a Laravel-style migration file with up and down methods, then write ClickHouse DDL such as CREATE TABLE, ALTER TABLE, or DROP TABLE inside those methods. The package applies those files through Artisan commands and records which versions have run. Keep each migration focused on one schema change so partial failures are easier to diagnose.
- How does the package track applied ClickHouse migrations?
- It maintains migration tracking so the runner can compare migration files on disk against versions already applied to ClickHouse. On each run it skips applied versions and executes only the pending ones, similar to Laravel's migrations table. Verify the tracking table's engine, idempotency on re-run, and behavior after a failed DDL statement in your own environment.
- Can I roll back ClickHouse migrations safely?
- Rollback depends on the down method in each migration file, so safety depends on how you implement it. ClickHouse DDL is not transactional, and an interrupted ALTER can leave partial state, so rollback is best-effort rather than an atomic undo. Treat rollbacks as a documented runbook and test them against a staging ClickHouse cluster before relying on them in production.
- What ClickHouse connection configuration does the package require?
- It uses a dedicated ClickHouse connection, so you provide host, port, database, username, and password alongside your normal Laravel database connections. Confirm whether the driver uses ClickHouse's HTTP interface or native TCP, and whether it supports TLS, basic auth, and a non-default port for your network policy. Isolating the connection keeps ClickHouse schema changes separate from your MySQL or Postgres migrations.
- Is it safe to run ClickHouse migrations during concurrent deployments?
- There is no documented advisory locking equivalent to Laravel's migration lock, so concurrent runners can double-apply DDL. Coordinate deploys so only one migrator runs at a time, or wrap the command with an external lock such as a cache or Redis lock. Test concurrent execution behavior in staging before trusting it in a multi-pod production deploy.
- Does it support ClickHouse clusters with ON CLUSTER and ReplicatedMergeTree?
- Cluster support is the hard part of ClickHouse schema management, and this small 2023-era package likely assumes single-node semantics. Verify whether ON CLUSTER statements work, whether the runner waits on system.distributed_ddl_queue, and whether ReplicatedMergeTree parameters can be templated per environment. If not, plan to extend the runner or run cluster DDL through a separate migration path.
- Can I use it alongside php artisan migrate for my relational database?
- Yes, the intent is to keep ClickHouse DDL versioned next to your application code while your normal Laravel migrations continue managing MySQL or Postgres. Because ClickHouse uses its own connection and tracking, the two migration streams run independently. Run relational migrations first if your ClickHouse tables depend on application schema or data shapes defined there.
- Is clickhouse-migrations maintained, and what are the alternatives?
- Maturity signals are weak: a single maintainer, very few stars, and a last release in February 2023, so treat it as a reference implementation rather than a heavily validated dependency. Alternatives include writing a custom Artisan command around the ClickHouse client, using a standalone clickhouse-migrations runner, or adopting a general migration tool with a ClickHouse driver. Whichever you choose, verify cluster DDL, locking, and rollback behavior against your own ClickHouse version.