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
new SchemaMigrations(
SimPod\ClickHouseClient\Client\ClickHouseClient $client,
?Psr\Log\LoggerInterface $logger = null,
)Methods
apply()
apply(
string $exposuresTable = AnalyticsSchemaV2::EXPOSURES_TABLE,
string $conversionsTable = AnalyticsSchemaV2::CONVERSIONS_TABLE,
): arrayrunner()
runner(
string $exposuresTable = AnalyticsSchemaV2::EXPOSURES_TABLE,
string $conversionsTable = AnalyticsSchemaV2::CONVERSIONS_TABLE,
): Rasuvaeff\ClickHouseToolkit\ClickHouseMigrationRunnerplaceholders()
static placeholders(
string $exposuresTable = AnalyticsSchemaV2::EXPOSURES_TABLE,
string $conversionsTable = AnalyticsSchemaV2::CONVERSIONS_TABLE,
): arrayThe {{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()
static path(): stringDirectory of the shipped .sql files, resolved from this file rather than assumed relative to the project root.