PHPackages                             alexeykhr/laravel-clickhouse-migrations - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. alexeykhr/laravel-clickhouse-migrations

ActiveLibrary[Database &amp; ORM](/categories/database)

alexeykhr/laravel-clickhouse-migrations
=======================================

Clickhouse migrations for Laravel

v1.0.1(5y ago)92.9k6[6 issues](https://github.com/Alexeykhr/laravel-clickhouse-migrations/issues)[6 PRs](https://github.com/Alexeykhr/laravel-clickhouse-migrations/pulls)MITPHPPHP ^7.2.5

Since Aug 10Pushed 4y ago1 watchersCompare

[ Source](https://github.com/Alexeykhr/laravel-clickhouse-migrations)[ Packagist](https://packagist.org/packages/alexeykhr/laravel-clickhouse-migrations)[ Docs](https://github.com/alexeykhr/laravel-clickhouse-migrations)[ RSS](/packages/alexeykhr-laravel-clickhouse-migrations/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (6)Versions (10)Used By (0)

Laravel Clickhouse Migrations
=============================

[](#laravel-clickhouse-migrations)

[![Build](https://github.com/Alexeykhr/laravel-clickhouse-migrations/workflows/PHP%20Composer/badge.svg)](https://github.com/Alexeykhr/laravel-clickhouse-migrations/workflows/PHP%20Composer/badge.svg)[![Latest Stable Version](https://camo.githubusercontent.com/5ecf1fd04ea4a17c715460ab21935560d72665ef1902fc5ef74c27abff8b0b41/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f616c657865796b68722f6c61726176656c2d636c69636b686f7573652d6d6967726174696f6e732e737667)](https://packagist.org/packages/alexeykhr/laravel-clickhouse-migrations)[![codecov](https://camo.githubusercontent.com/0fc2e272d46bed18f1848749aaafaae65c341b2d44d75f0b15a069dad91a6d8c/68747470733a2f2f636f6465636f762e696f2f67682f416c657865796b68722f6c61726176656c2d636c69636b686f7573652d6d6967726174696f6e732f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/Alexeykhr/laravel-clickhouse-migrations)[![Total Downloads](https://camo.githubusercontent.com/a4d5cb23877e1082c868286bfec0aee075cd0f69192dc580b3c4967c2f092905/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616c657865796b68722f6c61726176656c2d636c69636b686f7573652d6d6967726174696f6e732e737667)](https://packagist.org/packages/alexeykhr/laravel-clickhouse-migrations)[![Downloads Month](https://camo.githubusercontent.com/1dd984a0d86c12dc6b1c3f24e74222c63ca4dfb9e339918433ba3e235f606c86/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f616c657865796b68722f6c61726176656c2d636c69636b686f7573652d6d6967726174696f6e732e737667)](https://packagist.org/packages/alexeykhr/laravel-clickhouse-migrations)

---

- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Advances Usage](#advanced-usage)
    - [New Migration](#new-migration)
    - [Up Migrations](#up-migrations)
    - [Down Migrations](#down-migrations)
    - [Other](#other)
- [Changelog](#changelog)
- [License](#license)

Installation
------------

[](#installation)

Install this package via [Composer](https://getcomposer.org/).

```
$ composer require alexeykhr/laravel-clickhouse-migrations
```

> Note: **PHP 7.2.5 or later** is required

Publish Clickhouse configs:

```
$ php artisan vendor:publish --provider='Alexeykhr\ClickhouseMigrations\Providers\MigrationProvider'
```

Basic Usage
-----------

[](#basic-usage)

Create a new migration file:

```
$ php artisan make:clickhouse-migration {name}
```

Up migrations:

```
$ php artisan clickhouse-migrate
```

Down last migration:

```
$ php artisan clickhouse-migration:rollback
```

Advanced Usage
--------------

[](#advanced-usage)

### New Migration

[](#new-migration)

To create a new migration, use this command:

```
$ php artisan make:clickhouse-migration {name}
```

For example:

```
$ php artisan make:clickhouse-migration create_users_table
```

The new file will be located at the path specified in the configs: **clickhouse.path**

#### Table

[](#table)

You can use a more prepared stub from the library that contains a template for quickly adding a new table by adding the **--table** option:

```
$ php artisan make:clickhouse-migration create_users_table --table=users
```

#### Path

[](#path)

You can override the path to the migrations folder by passing the **--path** option:

```
$ php artisan make:clickhouse-migration create_users_table --path=database/new-migrations-folder
```

If you want to use an absolute path to the file, add one more option - **--realpath** to the existing option:

```
$ php artisan make:clickhouse-migration create_users_table --path=/path/to/migrations --realpath
```

#### Stub

[](#stub)

You can use your (override) prepared stub when creating a new file, list: **clickhouse.stubs**:

For example:

```
$ php artisan make:clickhouse-migration create_users_table --stub=default
```

Also you can add **Handlers**, with them, you can customize over one stub every time you create a file:

```
$ php artisan make:clickhouse-migration create_users_table --stub=myStub --stub.handler='App\Clickhouse\MyHandler'
```

> The class must implement the `Alexeykhr\ClickhouseMigrations\Contracts\MigrationStubHandlerContract` interface

You can pass your `$parameters`, for example:

```
$ php artisan make:clickhouse-migration create_users_table --stub.handler='App\Clickhouse\MyHandler' --stub.param=key:value --stub.param=table:products
```

You can also register a global handler that will apply to all generated stub files: `clickhouse.handlers.global`

### Up Migrations

[](#up-migrations)

[Path option with Realpath](#path)

#### Force

[](#force)

To remove the interactive question during production migrations, you can use **--force** option:

```
$ php artisan clickhouse-migrate --force
```

#### Output

[](#output)

To output migrations to be applied use **--output** option:

```
$ php artisan clickhouse-migrate --output
```

Before applying the shown migrations - will display an interactive question, to remove it, you can add another **--force** option to this option:

```
$ php artisan clickhouse-migrate --output --force
```

#### Step

[](#step)

You can specify how many files need to be applied:

```
$ php artisan clickhouse-migrate --step=1
```

> Value `0` - all files

### Down Migrations

[](#down-migrations)

Has the same properties as in [Up Migrations](#up-migrations).

### Other

[](#other)

You can use a singleton object [smi2/phpClickHouse](https://github.com/smi2/phpClickHouse#start) to query ClickHouse (used in migrations):

```
app('clickhouse')->select(/* Query */);
app('clickhouse')->write(/* Query */);
```

Changelog
---------

[](#changelog)

Detailed changes for each release are documented in the [CHANGELOG.md](https://github.com/Alexeykhr/laravel-clickhouse-migrations/blob/master/CHANGELOG.md).

License
-------

[](#license)

[MIT](https://opensource.org/licenses/MIT)

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance7

Infrequent updates — may be unmaintained

Popularity25

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity55

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 98.6% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

2

Last Release

2101d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9df8bcfe7ebdae74bff5f6ef23785a68ff725785bc860086465eaef1f1d1f7a9?d=identicon)[o.khrushch](/maintainers/o.khrushch)

---

Top Contributors

[![oleksiikhr](https://avatars.githubusercontent.com/u/14747569?v=4)](https://github.com/oleksiikhr "oleksiikhr (73 commits)")[![dependabot-preview[bot]](https://avatars.githubusercontent.com/in/2141?v=4)](https://github.com/dependabot-preview[bot] "dependabot-preview[bot] (1 commits)")

---

Tags

laravelpackagelibrarymigrationsclickhouse

### Embed Badge

![Health badge](/badges/alexeykhr-laravel-clickhouse-migrations/health.svg)

```
[![Health](https://phpackages.com/badges/alexeykhr-laravel-clickhouse-migrations/health.svg)](https://phpackages.com/packages/alexeykhr-laravel-clickhouse-migrations)
```

###  Alternatives

[cybercog/laravel-clickhouse

ClickHouse migrations for Laravel

163166.8k](/packages/cybercog-laravel-clickhouse)[tucker-eric/eloquentfilter

An Eloquent way to filter Eloquent Models

1.8k4.8M26](/packages/tucker-eric-eloquentfilter)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)[glushkovds/phpclickhouse-laravel

Adapter of the most popular library https://github.com/smi2/phpClickHouse to Laravel

2031.2M2](/packages/glushkovds-phpclickhouse-laravel)[erlandmuchasaj/laravel-gzip

Gzip your responses.

40129.3k2](/packages/erlandmuchasaj-laravel-gzip)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
