M260610000000CreateAbExperimentsTable
Rasuvaeff\Yii3AbTestingDb\Migration\M260610000000CreateAbExperimentsTable
Class · rasuvaeff/yii3-ab-testing-db · Source
Creates the experiments table read by \Rasuvaeff\Yii3AbTestingDb\DbExperimentProvider.
The table name defaults to ab_experiments and must match the table argument The table name comes from AbExperimentsTableName, which config/di.php builds from params — one source of truth for both migrations and the provider alike. Register them by namespace:
MigrationService::class => [
'setSourceNamespaces()' => [['Rasuvaeff\Yii3AbTestingDb\Migration']],
],variants holds a JSON object mapping each variant name to its non-negative integer weight, e.g. {"control":50,"green":50}. fallback_variant must be one of those variant names.
It carries no DEFAULT: MySQL rejects a literal default on a TEXT column outright (error 1101), and the value was never reachable anyway — the repository always writes variants, and an empty object fails \Rasuvaeff\Yii3AbTestingDb\ExperimentRowMapper validation on read. An INSERT that forgets the column must fail rather than store a row nothing can map.
Constructor
new M260610000000CreateAbExperimentsTable(
AbExperimentsTableName $table = new AbExperimentsTableName(),
)Methods
up()
up(Yiisoft\Db\Migration\MigrationBuilder $b): voiddown()
down(Yiisoft\Db\Migration\MigrationBuilder $b): void