mavlitov98 / clickhouse-migrations
Installs: 3 940
Dependents: 0
Suggesters: 0
Security: 0
Stars: 8
Watchers: 1
Forks: 1
Open Issues: 1
Type:symfony-bundle
Requires
- php: ^8.1
- fp4php/functional: ^5.2
- smi2/phpclickhouse: ^1.5
Requires (Dev)
- fp4php/psalm-toolkit: ^3.2
- symfony/config: ^6.0
- symfony/dependency-injection: ^6.0
- symfony/http-kernel: ^6.0
- vimeo/psalm: ^4.9
This package is auto-updated.
Last update: 2025-03-20 14:17:14 UTC
README
ClickhouseMigrationsBundle
This bundle integrates the Clickhouse Migrations into Symfony applications. Database migrations help you version the changes in your database schema and apply them in a predictable way on every server running the application.
Installation
composer require mavlitov98/clickhouse-migrations
If you don't use Symfony Flex, you must enable the bundle manually in the application:
// config/bundles.php // in older Symfony apps, enable the bundle in app/AppKernel.php return [ // ... ClickhouseMigrations\ClickhouseMigrationsBundle::class => ['all' => true], ];
Configuration
# in config/packages/clickhouse_migrations.yaml clickhouse_migrations: connection: # connection configuration (required) host: '%env(CLICKHOUSE_HOST)%' port: '%env(CLICKHOUSE_PORT)%' username: '%env(CLICKHOUSE_USERNAME)%' password: '%env(CLICKHOUSE_PASSWORD)%' clickhouse_migrations_version_table: 'ch_migrations' # version table name (optional) clickhouse_migrations_path: '%kernel.project_dir%/src/Migrations/Clickhouse' # migration path (optional) clickhouse_migrations_namespace: 'App\\Migrations\\Clickhouse' # migration class namespace (optional)
Commands
Generate new migration for ClickHouse:
php bin/console clickhouse-migrations:generate
Apply all generated migrations to ClickHouse:
php bin/console clickhouse-migrations:migrate
Apply or rollback ClickHouse migration:
php bin/console clickhouse-migrations:execute [VersionXXXXXXXXXXXXXX] [up|down]