File tree 6 files changed +54
-6
lines changed
Filter options
HttpFoundation/Session/Storage/Handler
Messenger/Bridge/Doctrine/Transport
6 files changed +54
-6
lines changed
Original file line number Diff line number Diff line change 13
13
14
14
use Doctrine \DBAL \Connection ;
15
15
use Doctrine \DBAL \Exception \TableNotFoundException ;
16
+ use Doctrine \DBAL \Schema \Name \Identifier ;
17
+ use Doctrine \DBAL \Schema \Name \UnqualifiedName ;
18
+ use Doctrine \DBAL \Schema \PrimaryKeyConstraint ;
16
19
use Doctrine \DBAL \Schema \Table ;
17
20
use Doctrine \DBAL \Types \Types ;
18
21
use Doctrine \ORM \Tools \Event \GenerateSchemaEventArgs ;
@@ -30,7 +33,12 @@ protected function getIsSameDatabaseChecker(Connection $connection): \Closure
30
33
$ table ->addColumn ('id ' , Types::INTEGER )
31
34
->setAutoincrement (true )
32
35
->setNotnull (true );
33
- $ table ->setPrimaryKey (['id ' ]);
36
+
37
+ if (class_exists (PrimaryKeyConstraint::class)) {
38
+ $ table ->addPrimaryKeyConstraint (new PrimaryKeyConstraint (null , [new UnqualifiedName (Identifier::unquoted ('id ' ))], true ));
39
+ } else {
40
+ $ table ->setPrimaryKey (['id ' ]);
41
+ }
34
42
35
43
$ schemaManager ->createTable ($ table );
36
44
Original file line number Diff line number Diff line change 13
13
14
14
use Doctrine \DBAL \Connection ;
15
15
use Doctrine \DBAL \ParameterType ;
16
+ use Doctrine \DBAL \Schema \Name \Identifier ;
17
+ use Doctrine \DBAL \Schema \Name \UnqualifiedName ;
18
+ use Doctrine \DBAL \Schema \PrimaryKeyConstraint ;
16
19
use Doctrine \DBAL \Schema \Schema ;
17
20
use Doctrine \DBAL \Types \Types ;
18
21
use Symfony \Component \Security \Core \Authentication \RememberMe \PersistentToken ;
@@ -193,6 +196,11 @@ private function addTableToSchema(Schema $schema): void
193
196
$ table ->addColumn ('lastUsed ' , Types::DATETIME_IMMUTABLE );
194
197
$ table ->addColumn ('class ' , Types::STRING , ['length ' => 100 ]);
195
198
$ table ->addColumn ('username ' , Types::STRING , ['length ' => 200 ]);
196
- $ table ->setPrimaryKey (['series ' ]);
199
+
200
+ if (class_exists (PrimaryKeyConstraint::class)) {
201
+ $ table ->addPrimaryKeyConstraint (new PrimaryKeyConstraint (null , [new UnqualifiedName (Identifier::unquoted ('series ' ))], true ));
202
+ } else {
203
+ $ table ->setPrimaryKey (['series ' ]);
204
+ }
197
205
}
198
206
}
Original file line number Diff line number Diff line change 19
19
use Doctrine \DBAL \Exception \TableNotFoundException ;
20
20
use Doctrine \DBAL \ParameterType ;
21
21
use Doctrine \DBAL \Schema \DefaultSchemaManagerFactory ;
22
+ use Doctrine \DBAL \Schema \Name \Identifier ;
23
+ use Doctrine \DBAL \Schema \Name \UnqualifiedName ;
24
+ use Doctrine \DBAL \Schema \PrimaryKeyConstraint ;
22
25
use Doctrine \DBAL \Schema \Schema ;
23
26
use Doctrine \DBAL \Tools \DsnParser ;
24
27
use Symfony \Component \Cache \Exception \InvalidArgumentException ;
@@ -378,6 +381,11 @@ private function addTableToSchema(Schema $schema): void
378
381
$ table ->addColumn ($ this ->dataCol , 'blob ' , ['length ' => 16777215 ]);
379
382
$ table ->addColumn ($ this ->lifetimeCol , 'integer ' , ['unsigned ' => true , 'notnull ' => false ]);
380
383
$ table ->addColumn ($ this ->timeCol , 'integer ' , ['unsigned ' => true ]);
381
- $ table ->setPrimaryKey ([$ this ->idCol ]);
384
+
385
+ if (class_exists (PrimaryKeyConstraint::class)) {
386
+ $ table ->addPrimaryKeyConstraint (new PrimaryKeyConstraint (null , [new UnqualifiedName (Identifier::unquoted ($ this ->idCol ))], true ));
387
+ } else {
388
+ $ table ->setPrimaryKey ([$ this ->idCol ]);
389
+ }
382
390
}
383
391
}
Original file line number Diff line number Diff line change 11
11
12
12
namespace Symfony \Component \HttpFoundation \Session \Storage \Handler ;
13
13
14
+ use Doctrine \DBAL \Schema \Name \Identifier ;
15
+ use Doctrine \DBAL \Schema \Name \UnqualifiedName ;
16
+ use Doctrine \DBAL \Schema \PrimaryKeyConstraint ;
14
17
use Doctrine \DBAL \Schema \Schema ;
15
18
use Doctrine \DBAL \Types \Types ;
16
19
@@ -224,7 +227,13 @@ public function configureSchema(Schema $schema, ?\Closure $isSameDatabase = null
224
227
default :
225
228
throw new \DomainException (\sprintf ('Creating the session table is currently not implemented for PDO driver "%s". ' , $ this ->driver ));
226
229
}
227
- $ table ->setPrimaryKey ([$ this ->idCol ]);
230
+
231
+ if (class_exists (PrimaryKeyConstraint::class)) {
232
+ $ table ->addPrimaryKeyConstraint (new PrimaryKeyConstraint (null , [new UnqualifiedName (Identifier::unquoted ($ this ->idCol ))], true ));
233
+ } else {
234
+ $ table ->setPrimaryKey ([$ this ->idCol ]);
235
+ }
236
+
228
237
$ table ->addIndex ([$ this ->lifetimeCol ], $ this ->lifetimeCol .'_idx ' );
229
238
}
230
239
Original file line number Diff line number Diff line change 18
18
use Doctrine \DBAL \Exception \TableNotFoundException ;
19
19
use Doctrine \DBAL \ParameterType ;
20
20
use Doctrine \DBAL \Schema \DefaultSchemaManagerFactory ;
21
+ use Doctrine \DBAL \Schema \Name \Identifier ;
22
+ use Doctrine \DBAL \Schema \Name \UnqualifiedName ;
23
+ use Doctrine \DBAL \Schema \PrimaryKeyConstraint ;
21
24
use Doctrine \DBAL \Schema \Schema ;
22
25
use Doctrine \DBAL \Tools \DsnParser ;
23
26
use Symfony \Component \Lock \Exception \InvalidArgumentException ;
@@ -214,7 +217,12 @@ public function configureSchema(Schema $schema, \Closure $isSameDatabase): void
214
217
$ table ->addColumn ($ this ->idCol , 'string ' , ['length ' => 64 ]);
215
218
$ table ->addColumn ($ this ->tokenCol , 'string ' , ['length ' => 44 ]);
216
219
$ table ->addColumn ($ this ->expirationCol , 'integer ' , ['unsigned ' => true ]);
217
- $ table ->setPrimaryKey ([$ this ->idCol ]);
220
+
221
+ if (class_exists (PrimaryKeyConstraint::class)) {
222
+ $ table ->addPrimaryKeyConstraint (new PrimaryKeyConstraint (null , [new UnqualifiedName (Identifier::unquoted ($ this ->idCol ))], true ));
223
+ } else {
224
+ $ table ->setPrimaryKey ([$ this ->idCol ]);
225
+ }
218
226
}
219
227
220
228
/**
Original file line number Diff line number Diff line change 23
23
use Doctrine \DBAL \Query \QueryBuilder ;
24
24
use Doctrine \DBAL \Result ;
25
25
use Doctrine \DBAL \Schema \AbstractAsset ;
26
+ use Doctrine \DBAL \Schema \Name \Identifier ;
27
+ use Doctrine \DBAL \Schema \Name \UnqualifiedName ;
28
+ use Doctrine \DBAL \Schema \PrimaryKeyConstraint ;
26
29
use Doctrine \DBAL \Schema \Schema ;
27
30
use Doctrine \DBAL \Schema \Table ;
28
31
use Doctrine \DBAL \Types \Types ;
@@ -519,7 +522,11 @@ private function addTableToSchema(Schema $schema): void
519
522
->setNotnull (true );
520
523
$ table ->addColumn ('delivered_at ' , Types::DATETIME_IMMUTABLE )
521
524
->setNotnull (false );
522
- $ table ->setPrimaryKey (['id ' ]);
525
+ if (class_exists (PrimaryKeyConstraint::class)) {
526
+ $ table ->addPrimaryKeyConstraint (new PrimaryKeyConstraint (null , [new UnqualifiedName (Identifier::unquoted ('id ' ))], true ));
527
+ } else {
528
+ $ table ->setPrimaryKey (['id ' ]);
529
+ }
523
530
$ table ->addIndex (['queue_name ' ]);
524
531
$ table ->addIndex (['available_at ' ]);
525
532
$ table ->addIndex (['delivered_at ' ]);
You can’t perform that action at this time.
0 commit comments