Download the PHP package onnov/php-clickhouse-migrator without Composer
On this page you can find all versions of the php package onnov/php-clickhouse-migrator. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download onnov/php-clickhouse-migrator
More information about onnov/php-clickhouse-migrator
Files in onnov/php-clickhouse-migrator
Package php-clickhouse-migrator
Short Description Migrations for Clickhouse
License MIT
Informations about the package php-clickhouse-migrator
php-clickhouse-migrator
- Migrations for Clickhouse. Fork from https://github.com/khaydarov/php-clickhouse-migrator
- For php-8. && Symfony 6.
composer r onnov/php-clickhouse-migrator
Requirements
PHP 7.0 or newer
Installation
It is available from composer
After installation you can run migrator commands via
script ./vendor/bin/clickhouse-migrator
Usage
When you run the script there will be the list of available commands
Initialization
Each command is executed in the project's root where composer.json and vendor directory placed.
Before running commands you need to create a config file. It is possible
to use your own created file or run init
to create new one.
The command below creates new php config file
Configuration
There are two supporting config extensions: YAML and PHP
The config structure
default
points to the environment credentials.
This property value used when -e
is not passed
Creating new revision
Use the create
command to create a new revision
The RevisionName is a class name, so it must be in camel case notation.
Migration file will be like 20200125120301_RevisionName
, where 20200125120301
is ID and the rest is class name.
After running the command the file 20200125120301_RevisionName.php
will be appeared in migration path
up()
method is used for migrations and down()
for rollbacks.
Currently rollback
and status
are not implemented. But it will be done soon.
Initially AbstractMigration provides three methods:
- getDatabase() — the database name from config file
- getCluster() - the cluster name from config file
- execute(string $query) - method executes passed SQL query
Development
Tests
All versions of php-clickhouse-migrator with dependencies
smi2/phpclickhouse Version ^1.3
symfony/yaml Version ^5.0|^6.0
symfony/console Version ^5.0|^6.0