File tree 3 files changed +34
-1
lines changed
3 files changed +34
-1
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,14 @@ class Configuration
56
56
*/
57
57
protected $ autoCommit = true ;
58
58
59
+ /**
60
+ * Whether type comments should be disabled to provide the same DB schema than
61
+ * will be obtained with DBAL 4.x. This is useful when relying only on the
62
+ * platform-aware schema comparison (which does not need those type comments)
63
+ * rather than the deprecated legacy tooling.
64
+ */
65
+ private bool $ disableTypeComments = false ;
66
+
59
67
private ?SchemaManagerFactory $ schemaManagerFactory = null ;
60
68
61
69
public function __construct ()
@@ -241,4 +249,17 @@ public function setSchemaManagerFactory(SchemaManagerFactory $schemaManagerFacto
241
249
242
250
return $ this ;
243
251
}
252
+
253
+ public function getDisableTypeComments (): bool
254
+ {
255
+ return $ this ->disableTypeComments ;
256
+ }
257
+
258
+ /** @return $this */
259
+ public function setDisableTypeComments (bool $ disableTypeComments ): self
260
+ {
261
+ $ this ->disableTypeComments = $ disableTypeComments ;
262
+
263
+ return $ this ;
264
+ }
244
265
}
Original file line number Diff line number Diff line change @@ -209,6 +209,7 @@ public function __construct(
209
209
210
210
$ this ->platform = $ params ['platform ' ];
211
211
$ this ->platform ->setEventManager ($ this ->_eventManager );
212
+ $ this ->platform ->setDisableTypeComments ($ config ->getDisableTypeComments ());
212
213
}
213
214
214
215
$ this ->_expr = $ this ->createExpressionBuilder ();
@@ -315,6 +316,7 @@ public function getDatabasePlatform()
315
316
if ($ this ->platform === null ) {
316
317
$ this ->platform = $ this ->detectDatabasePlatform ();
317
318
$ this ->platform ->setEventManager ($ this ->_eventManager );
319
+ $ this ->platform ->setDisableTypeComments ($ this ->_config ->getDisableTypeComments ());
318
320
}
319
321
320
322
return $ this ->platform ;
Original file line number Diff line number Diff line change @@ -103,6 +103,16 @@ abstract class AbstractPlatform
103
103
*/
104
104
protected $ _keywords ;
105
105
106
+ private bool $ disableTypeComments = false ;
107
+
108
+ /**
109
+ * @internal
110
+ */
111
+ final public function setDisableTypeComments (bool $ value ): void
112
+ {
113
+ $ this ->disableTypeComments = $ value ;
114
+ }
115
+
106
116
/**
107
117
* Sets the EventManager used by the Platform.
108
118
*
@@ -578,7 +588,7 @@ protected function getColumnComment(Column $column)
578
588
579
589
$ comment = $ column ->getComment ();
580
590
581
- if ($ column ->getType ()->requiresSQLCommentHint ($ this )) {
591
+ if (! $ this -> disableTypeComments && $ column ->getType ()->requiresSQLCommentHint ($ this )) {
582
592
$ comment .= $ this ->getDoctrineTypeComment ($ column ->getType ());
583
593
}
584
594
You can’t perform that action at this time.
0 commit comments