Skip to content

Commit

Permalink
Use jsonb when using postgresql
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielBadura committed Jan 6, 2025
1 parent d4226fe commit dd53bd1
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Store/DoctrineDbalStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ public function configureSchema(Schema $schema, Connection $connection): void
->setLength(255)
->setNotnull(true);
$table->addColumn('payload', Types::JSON)
->setPlatformOption('jsonb', true)
->setNotnull(true);
$table->addColumn('recorded_on', Types::DATETIMETZ_IMMUTABLE)
->setNotnull(true);
Expand All @@ -341,6 +342,7 @@ public function configureSchema(Schema $schema, Connection $connection): void
->setNotnull(true)
->setDefault(false);
$table->addColumn('custom_headers', Types::JSON)
->setPlatformOption('jsonb', true)
->setNotnull(true);

$table->setPrimaryKey(['id']);
Expand Down
2 changes: 2 additions & 0 deletions src/Store/StreamDoctrineDbalStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ public function configureSchema(Schema $schema, Connection $connection): void
->setLength(255)
->setNotnull(true);
$table->addColumn('event_payload', Types::JSON)
->setPlatformOption('jsonb', true)
->setNotnull(true);
$table->addColumn('recorded_on', Types::DATETIMETZ_IMMUTABLE)
->setNotnull(true);
Expand All @@ -409,6 +410,7 @@ public function configureSchema(Schema $schema, Connection $connection): void
->setNotnull(true)
->setDefault(false);
$table->addColumn('custom_headers', Types::JSON)
->setPlatformOption('jsonb', true)
->setNotnull(true);

$table->setPrimaryKey(['id']);
Expand Down
1 change: 1 addition & 0 deletions src/Subscription/Store/DoctrineSubscriptionStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,7 @@ public function configureSchema(Schema $schema, Connection $connection): void
->setLength(32)
->setNotnull(false);
$table->addColumn('error_context', Types::JSON)
->setPlatformOption('jsonb', true)
->setNotnull(false);
$table->addColumn('retry_attempt', Types::INTEGER)
->setNotnull(true);
Expand Down
4 changes: 4 additions & 0 deletions tests/Unit/Store/DoctrineDbalStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,7 @@ public function testConfigureSchema(): void
->setLength(255)
->setNotnull(true);
$table->addColumn('payload', Types::JSON)
->setPlatformOption('jsonb', true)
->setNotnull(true);
$table->addColumn('recorded_on', Types::DATETIMETZ_IMMUTABLE)
->setNotnull(true);
Expand All @@ -1319,6 +1320,7 @@ public function testConfigureSchema(): void
->setNotnull(true)
->setDefault(false);
$table->addColumn('custom_headers', Types::JSON)
->setPlatformOption('jsonb', true)
->setNotnull(true);

$table->setPrimaryKey(['id']);
Expand Down Expand Up @@ -1361,6 +1363,7 @@ public function testConfigureSchemaWithStringAsAggregateIdType(): void
->setLength(255)
->setNotnull(true);
$table->addColumn('payload', Types::JSON)
->setPlatformOption('jsonb', true)
->setNotnull(true);
$table->addColumn('recorded_on', Types::DATETIMETZ_IMMUTABLE)
->setNotnull(true);
Expand All @@ -1371,6 +1374,7 @@ public function testConfigureSchemaWithStringAsAggregateIdType(): void
->setNotnull(true)
->setDefault(false);
$table->addColumn('custom_headers', Types::JSON)
->setPlatformOption('jsonb', true)
->setNotnull(true);

$table->setPrimaryKey(['id']);
Expand Down
2 changes: 2 additions & 0 deletions tests/Unit/Store/StreamDoctrineDbalStoreTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -1404,6 +1404,7 @@ public function testConfigureSchema(): void
->setLength(255)
->setNotnull(true);
$table->addColumn('event_payload', Types::JSON)
->setPlatformOption('jsonb', true)
->setNotnull(true);
$table->addColumn('recorded_on', Types::DATETIMETZ_IMMUTABLE)
->setNotnull(true);
Expand All @@ -1414,6 +1415,7 @@ public function testConfigureSchema(): void
->setNotnull(true)
->setDefault(false);
$table->addColumn('custom_headers', Types::JSON)
->setPlatformOption('jsonb', true)
->setNotnull(true);

$table->setPrimaryKey(['id']);
Expand Down

0 comments on commit dd53bd1

Please sign in to comment.