classCreateTableLikeMutation
final class CreateTableLikeMutation
implements ShadowMutation
Applies CREATE TABLE ... LIKE ... operation to the virtual schema. This mutation copies the TableDefinition from an existing table to a new table.
Methods§
public function __construct(
string $tableName,
string $sourceTableName,
TableDefinitionRegistry $registry,
bool $ifNotExists = false,
)Binds the instance to what it will work from.
Parameters
$tableName | string | |
$sourceTableName | string | |
$registry | TableDefinitionRegistry | |
$ifNotExists | bool |
public function apply(ShadowStore $store, array $rows): void{@inheritDoc}
Parameters
$store | ShadowStore | |
$rows | array |
Throws
RuntimeException When the table being copied from is not one anything has describedTest cases 5
CreateTableLikeMutationTest::testApplyCopiesSchemaFromSourceTablecallsCreateTableLikeMutationTest::testApplyEnsuresNewTableInShadowStorecallsCreateTableLikeMutationTest::testApplyThrowsExceptionWhenSourceTableDoesNotExistcallsCreateTableLikeMutationTest::testApplyThrowsExceptionWhenTargetTableExistscallsCreateTableLikeMutationTest::testApplyWithIfNotExistsSkipsWhenTableExistscalls
Calls 5
- method-call TableDefinitionRegistry::has() line 51
- new
RuntimeExceptionline 55 - method-call TableDefinitionRegistry::get() line 58
- method-call TableDefinitionRegistry::register() line 63
- method-call ShadowStore::ensure() line 64
public function tableName(): string{@inheritDoc}
Returns
stringTest cases 1
Private surface 4§
Implementation details, listed for orientation only.
private string $tableNameprivate string $sourceTableNameprivate TableDefinitionRegistry $registryprivate bool $ifNotExistsTest cases 14§
Test cases that cover or call this symbol, from the coverage report and from the analyzed test sources.
Dedicated tests 6
CreateTableLikeMutationTest::testApplyCopiesSchemaFromSourceTablecallsCreateTableLikeMutationTest::testApplyEnsuresNewTableInShadowStorecallsCreateTableLikeMutationTest::testApplyThrowsExceptionWhenSourceTableDoesNotExistcallsCreateTableLikeMutationTest::testApplyThrowsExceptionWhenTargetTableExistscallsCreateTableLikeMutationTest::testApplyWithIfNotExistsSkipsWhenTableExistscallsCreateTableLikeMutationTest::testTableNameReturnsNewTableNamecalls
Other tests reaching this symbol 8
MySqlRewriterTest::testCreateTableLikeCopiesSchemacallsMySqlRewriterTest::testRewriteCreateTableLikeCreatesMutationcallsMySqlMutationResolverTest::testResolveCreateTableLikecallsMySqlMutationResolverTest::testResolveCreateTableLikeReturnsCreateTableLikeMutationcallsPgSqlMutationResolverTest::testResolveCreateTableLikeReturnsCreateTableLikeMutationcallsPgSqlMutationResolverTest::testResolveCreateTableLikeSourceRegisteredcallsPgSqlMutationResolverTest::testResolveCreateTableLikeWithIfNotExistscallsPgSqlMutationResolverTest::testResolveCreateTableLikeWithKnownSourcecalls
Relations§
Instantiated in 2
- new ZtdQuery\Platform\MySql\Shadow\Mutation\Table\TableMutationResolver::resolveCreateTable() packages/ztd-query-mysql/src/Shadow/Mutation/Table/TableMutationResolver.php:60
- new ZtdQuery\Platform\Postgres\Shadow\Mutation\Table\TableMutationResolver::resolveCreateTable() packages/ztd-query-postgres/src/Shadow/Mutation/Table/TableMutationResolver.php:73