Skip to content

SchemaMigrations ​

Rasuvaeff\Yii3AbTestingClickHouse\SchemaMigrations

Class · rasuvaeff/yii3-ab-testing-clickhouse · Source

Applies the schema this package owns.

Without it every consumer hardcodes vendor/rasuvaeff/yii3-ab-testing-clickhouse/migrations and its own placeholder map — a path that breaks on a vendor-dir rename and a map that drifts from the DDL. The table names come from AnalyticsSchemaV2, so the constants a producer checks against and the tables actually created can only ever be the same.

Applying migrations is deliberately explicit rather than automatic: creating analytics tables is a deployment step, and the shipped retention/ templates are never applied here at all, because enabling row deletion on a package upgrade would be indefensible.

Constructor ​

php
new SchemaMigrations(
    SimPod\ClickHouseClient\Client\ClickHouseClient $client,
    ?Psr\Log\LoggerInterface $logger = null,
)

Methods ​

apply() ​

php
apply(
    string $exposuresTable = AnalyticsSchemaV2::EXPOSURES_TABLE,
    string $conversionsTable = AnalyticsSchemaV2::CONVERSIONS_TABLE,
): array

runner() ​

php
runner(
    string $exposuresTable = AnalyticsSchemaV2::EXPOSURES_TABLE,
    string $conversionsTable = AnalyticsSchemaV2::CONVERSIONS_TABLE,
): Rasuvaeff\ClickHouseToolkit\ClickHouseMigrationRunner

placeholders() ​

php
static placeholders(
    string $exposuresTable = AnalyticsSchemaV2::EXPOSURES_TABLE,
    string $conversionsTable = AnalyticsSchemaV2::CONVERSIONS_TABLE,
): array

The {{token}} map the shipped DDL expects.

Public because an application that runs its own migration pipeline still needs the exact tokens, and guessing them yields "unresolved placeholder" at deploy time rather than at build time.

path() ​

php
static path(): string

Directory of the shipped .sql files, resolved from this file rather than assumed relative to the project root.