Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit49b57f0

Browse files
committed
[Messenger] Fix Oracle errors 'ORA-00955: Name is already used by an existing object' with Doctrine transport
1 parent91ed2eb commit49b57f0

File tree

1 file changed

+10
-3
lines changed
  • src/Symfony/Component/Messenger/Bridge/Doctrine/Transport

1 file changed

+10
-3
lines changed

‎src/Symfony/Component/Messenger/Bridge/Doctrine/Transport/Connection.php

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,9 @@ public function setup(): void
302302
thrownew \TypeError(\sprintf('The table name must be an instance of "%s" or a string ("%s" given).', AbstractAsset::class,get_debug_type($tableName)));
303303
}
304304

305-
return$tableName ===$this->configuration['table_name'];
305+
// SchemaAssetsFilter needs to match the messenger table name and also the messenger sequence name to make $schemaDiff work correctly in updateSchema()
306+
// This may also work for other databases if their sequence name is suffixed with '_seq', '_id_seq' or similar.
307+
returnstr_starts_with($tableName,$this->configuration['table_name']);// MESSENGER_MESSAGES*
306308
});
307309
$this->updateSchema();
308310
$configuration->setSchemaAssetsFilter($assetFilter);
@@ -533,9 +535,14 @@ private function addTableToSchema(Schema $schema): void
533535

534536
// We need to create a sequence for Oracle and set the id column to get the correct nextval
535537
if ($this->driverConnection->getDatabasePlatform()instanceof OraclePlatform) {
536-
$idColumn->setDefault($this->configuration['table_name'].self::ORACLE_SEQUENCES_SUFFIX.'.nextval');
538+
$serverVersion =$this->driverConnection->getWrappedConnection()->getServerVersion();
539+
if (version_compare($serverVersion,'12.1.0','>=')) {
540+
$idColumn->setAutoincrement(false);// disable the creation of SEQUENCE and TRIGGER
541+
// The line below is taken into account only if Oracle version is >= 12.1.0
542+
$idColumn->setDefault($this->configuration['table_name'].self::ORACLE_SEQUENCES_SUFFIX.'.nextval');
537543

538-
$schema->createSequence($this->configuration['table_name'].self::ORACLE_SEQUENCES_SUFFIX);
544+
$schema->createSequence($this->configuration['table_name'].self::ORACLE_SEQUENCES_SUFFIX);
545+
}
539546
}
540547
}
541548

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp