alexeykhr/laravel-clickhouse-migrations
Composer 安装命令:
composer require alexeykhr/laravel-clickhouse-migrations
包简介
Clickhouse migrations for Laravel
README 文档
README
Installation
Install this package via Composer.
$ 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
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
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
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
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
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\MigrationStubHandlerContractinterface
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
Force
To remove the interactive question during production migrations, you can use --force option:
$ php artisan clickhouse-migrate --force
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
You can specify how many files need to be applied:
$ php artisan clickhouse-migrate --step=1
Value
0- all files
Down Migrations
Has the same properties as in Up Migrations.
Other
You can use a singleton object smi2/phpClickHouse to query ClickHouse (used in migrations):
app('clickhouse')->select(/* Query */); app('clickhouse')->write(/* Query */);
Changelog
Detailed changes for each release are documented in the CHANGELOG.md.
License
alexeykhr/laravel-clickhouse-migrations 适用场景与选型建议
alexeykhr/laravel-clickhouse-migrations 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2.94k 次下载、GitHub Stars 达 9, 最近一次更新时间为 2020 年 08 月 09 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「migrations」 「package」 「library」 「laravel」 「clickhouse」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 alexeykhr/laravel-clickhouse-migrations 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 alexeykhr/laravel-clickhouse-migrations 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 alexeykhr/laravel-clickhouse-migrations 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Symfony ClickhouseMigrationsBundle
Very simple SQL-based database migrations tool - a heavily stripped down fork of robmorgan/phinx
Laravel table comments loader (part of Diplodocker project)
A lightweight, secure-by-default PHP microframework built on Slim – providing Laravel-like features (ORM, authentication, migrations, caching) without the bloat. Perfect for building REST APIs and small-to-medium PHP applications.
Inbox pattern process implementation for your Laravel Applications
统计信息
- 总下载量: 2.94k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 8
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2020-08-09