classCreateTableMutation
final class CreateTableMutation
implements ShadowMutation
Applies CREATE TABLE operation to the virtual schema. This mutation registers a new table in the TableDefinitionRegistry.
Methods§
public function __construct(
string $tableName,
TableDefinition|null $definition,
TableDefinitionRegistry $registry,
string $sourceSql,
bool $ifNotExists = false,
)Parameters
$tableName | string | The name of the table to create. |
$definition | TableDefinition|null | The parsed table definition. |
$registry | TableDefinitionRegistry | The registry to register the table. |
$sourceSql | string | The source statement supplied by the database package. |
$ifNotExists | bool | Whether to skip if table exists. |
Test cases 6
CreateTableMutationTest::testApplyEnsuresTableInShadowStorecoversCreateTableMutationTest::testApplyRegistersTableInSchemacoversCreateTableMutationTest::testApplyThrowsExceptionWhenTableExistscoversCreateTableMutationTest::testApplyWithIfNotExistsCreatesWhenTableDoesNotExistcoversCreateTableMutationTest::testApplyWithIfNotExistsSkipsWhenTableExistscoversCreateTableMutationTest::testTableNameReturnsTableNamecovers
public function apply(ShadowStore $store, array $rows): void{@inheritDoc}
Parameters
$store | ShadowStore | |
$rows | array |
Throws
TableAlreadyExistsException When the table is already there and the statement did not allow for thatTest cases 5
CreateTableMutationTest::testApplyEnsuresTableInShadowStorecovers and callsCreateTableMutationTest::testApplyRegistersTableInSchemacovers and callsCreateTableMutationTest::testApplyThrowsExceptionWhenTableExistscovers and callsCreateTableMutationTest::testApplyWithIfNotExistsCreatesWhenTableDoesNotExistcovers and callsCreateTableMutationTest::testApplyWithIfNotExistsSkipsWhenTableExistscovers and calls
Calls 4
- method-call TableDefinitionRegistry::has() line 53
- new TableAlreadyExistsException line 57
- method-call TableDefinitionRegistry::register() line 61
- method-call ShadowStore::ensure() line 64
public function tableName(): string{@inheritDoc}
Returns
stringTest cases 1
CreateTableMutationTest::testTableNameReturnsTableNamecovers and calls
Private surface 5§
Implementation details, listed for orientation only.
private string $tableNameprivate ?TableDefinition $definitionprivate TableDefinitionRegistry $registryprivate string $sourceSqlprivate bool $ifNotExistsTest cases 9§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
CreateTableMutationTest::testApplyEnsuresTableInShadowStorecovers and callsCreateTableMutationTest::testApplyRegistersTableInSchemacovers and callsCreateTableMutationTest::testApplyThrowsExceptionWhenTableExistscovers and callsCreateTableMutationTest::testApplyWithIfNotExistsCreatesWhenTableDoesNotExistcovers and callsCreateTableMutationTest::testApplyWithIfNotExistsSkipsWhenTableExistscovers and callsCreateTableMutationTest::testTableNameReturnsTableNamecovers and calls
Other tests reaching this symbol 3
Relations§
Constant reads 1
- class-const packages/ztd-query-core/src/Compatibility/ClassAliases.php packages/ztd-query-core/src/Compatibility/ClassAliases.php:29