8000 Fixed messenger auto_setup for Oracle databases · symfony/symfony@e799d36 · GitHub
[go: up one dir, main page]

Skip to content

Commit e799d36

Browse files
committed
Fixed messenger auto_setup for Oracle databases
1 parent 1e1cd79 commit e799d36

File tree

1 file changed

+8
-1
lines changed
  • src/Symfony/Component/Messenger/Bridge/Doctrine/Transport

1 file changed

+8
-1
lines changed

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ private function addTableToSchema(Schema $schema): void
519519
$table = $schema->createTable($this->configuration['table_name']);
520520
// add an internal option to mark that we created this & the non-namespaced table name
521521
$table->addOption(self::TABLE_OPTION_NAME, $this->configuration['table_name']);
522-
$table->addColumn('id', Types::BIGINT)
522+
$idColumn = $table->addColumn('id', Types::BIGINT)
523523
->setAutoincrement(true)
524524
->setNotnull(true);
525525
$table->addColumn('body', Types::TEXT)
@@ -539,6 +539,13 @@ private function addTableToSchema(Schema $schema): void
539539
$table->addIndex(['queue_name']);
540540
$table->addIndex(['available_at']);
541541
$table->addIndex(['delivered_at']);
542+
543+
// We need to create a sequence for Oracle and set the id column to get the correct nextval
544+
if ($this->driverConnection->getDatabasePlatform() instanceof OraclePlatform) {
545+
$idColumn->setDefault('seq_'.$this->configuration['table_name'].'.nextval');
546+
547+
$schema->createSequence('seq_'.$this->configuration['table_name']);
548+
}
542549
}
543550

544551
private function decodeEnvelopeHeaders(array $doctrineEnvelope): array

0 commit comments

Comments
 (0)
0