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. |
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::testApplyEnsuresTableInShadowStorecallsCreateTableMutationTest::testApplyRegistersTableInSchemacallsCreateTableMutationTest::testApplyThrowsExceptionWhenTableExistscallsCreateTableMutationTest::testApplyWithIfNotExistsCreatesWhenTableDoesNotExistcallsCreateTableMutationTest::testApplyWithIfNotExistsSkipsWhenTableExistscalls
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
Private surface 5§
Implementation details, listed for orientation only.
private string $tableNameprivate ?TableDefinition $definitionprivate TableDefinitionRegistry $registryprivate string $sourceSqlprivate bool $ifNotExistsTest cases 44§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
CreateTableMutationTest::testApplyEnsuresTableInShadowStorecallsCreateTableMutationTest::testApplyRegistersTableInSchemacallsCreateTableMutationTest::testApplyThrowsExceptionWhenTableExistscallsCreateTableMutationTest::testApplyWithIfNotExistsCreatesWhenTableDoesNotExistcallsCreateTableMutationTest::testApplyWithIfNotExistsSkipsWhenTableExistscallsCreateTableMutationTest::testTableNameReturnsTableNamecalls
Other tests reaching this symbol 38
FakeSqlRewriter::rewriteDdlcallsMySqlRewriterTest::testCreateTableIfNotExistsSkipsExistingTablecallsMySqlRewriterTest::testCreateTableMutationRegistersSchemacallsMySqlRewriterTest::testCreateTemporaryTableRegistersSchemacallsMySqlRewriterTest::testRewriteCreateTableCreatesMutationcallsMySqlRewriterTest::testRewriteCreateTemporaryTableCreatesMutationcallsPgSqlRewriterTest::testCreateTableNotAsSelectReturnsSqlWhereFalsecallsPgSqlRewriterTest::testCreateTableReturnsDdlSimulatedcallsSqliteRewriterTest::testCreateTableReturnsDdlSimulatedcallsDataMutationTest::testAMutationThatChangesNoRowsCarriesNothingToTheChildrencallsMySqlMutationResolverTest::testCreateTableIfNotExistsWhenExistscallsMySqlMutationResolverTest::testResolveCreateTableIfNotExistsDoesNotThrowForExistingTablecallsMySqlMutationResolverTest::testResolveCreateTableIfNotExistsSkipsWhenExistscallsMySqlMutationResolverTest::testResolveCreateTableReturnsCreateTableMutationcallsPgSqlMutationResolverTest::testResolveCreateTableAlreadyExistsWithIfNotExistscallsPgSqlMutationResolverTest::testResolveCreateTableIfNotExistsDoesNotThrowWhenAlreadyExistscallsPgSqlMutationResolverTest::testResolveCreateTableIfNotExistsWhenTableExistscallsPgSqlMutationResolverTest::testResolveCreateTableLowercaseExtractsTablecallsPgSqlMutationResolverTest::testResolveCreateTableReturnsCreateTableMutationcallsReferentialIntegrityEnforcerTest::testSchemaMutationDoesNotTriggerRowValidationcallsTableMutationResolverTest::testResolveCreateTablecallsTableMutationResolverTest::testResolveCreateTableCaseInsensitiveIfNotExistscallsTableMutationResolverTest::testResolveCreateTableIfNotExistscallsTableMutationResolverTest::testResolveCreateTableIfNotExistsExistingTableLowercasecallsTableMutationResolverTest::testResolveCreateTableIfNotExistsExistingTableNoErrorcallsTableMutationResolverTest::testResolveCreateTableIfNotExistsLowercasecallsTableMutationResolverTest::testResolveCreateTableIfNotExistsLowercaseDoesNotThrowcallsTableMutationResolverTest::testResolveCreateTableIfNotExistsWithoutExistingTablecallsTableMutationResolverTest::testResolveCreateTableTableNamecallsSqliteMutationResolverTest::testResolveCreateTablecallsSqliteMutationResolverTest::testResolveCreateTableCaseInsensitiveIfNotExistscallsSqliteMutationResolverTest::testResolveCreateTableIfNotExistscallsSqliteMutationResolverTest::testResolveCreateTableIfNotExistsExistingTableLowercasecallsSqliteMutationResolverTest::testResolveCreateTableIfNotExistsExistingTableNoErrorcallsSqliteMutationResolverTest::testResolveCreateTableIfNotExistsLowercasecallsSqliteMutationResolverTest::testResolveCreateTableIfNotExistsLowercaseDoesNotThrowcallsSqliteMutationResolverTest::testResolveCreateTableIfNotExistsWithoutExistingTablecallsSqliteMutationResolverTest::testResolveCreateTableTableNamecalls
Relations§
Instantiated in 4
- new ZtdQuery\Platform\MySql\Shadow\Mutation\Table\TableMutationResolver::resolveCreateTable() packages/ztd-query-mysql/src/Shadow/Mutation/Table/TableMutationResolver.php:75
- new ZtdQuery\Platform\Postgres\Shadow\Mutation\Table\TableMutationResolver::resolveCreateTable() packages/ztd-query-postgres/src/Shadow/Mutation/Table/TableMutationResolver.php:91
- new ZtdQuery\Platform\Postgres\Shadow\Mutation\Table\TableMutationResolver::resolvePartition() packages/ztd-query-postgres/src/Shadow/Mutation/Table/TableMutationResolver.php:158
- new ZtdQuery\Platform\Sqlite\Shadow\Resolution\TableMutationResolver::resolveCreateTable() packages/ztd-query-sqlite/src/Shadow/Resolution/TableMutationResolver.php:52