File tree Expand file tree Collapse file tree 6 files changed +55
-8
lines changed Expand file tree Collapse file tree 6 files changed +55
-8
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,13 @@ awareness about deprecated code.
8
8
9
9
# Upgrade to 3.5
10
10
11
+ ## Deprecated ` ColumnDiff ` APIs dedicated to the old column name.
12
+
13
+ The ` $oldColumnName ` property and the ` getOldColumnName() ` method of the ` ColumnDiff ` class have been deprecated.
14
+
15
+ Make sure the ` $fromColumn ` argument is passed to the ` ColumnDiff ` constructor and use the ` $fromColumnName ` property
16
+ instead.
17
+
11
18
## Marked schema diff constructors as internal.
12
19
13
20
The constructors of the following classes have been marked as internal:
Original file line number Diff line number Diff line change 414
414
-->
415
415
<referencedMethod name =" Doctrine\DBAL\Schema\AbstractSchemaManager::listTableDetails" />
416
416
<referencedMethod name =" Doctrine\DBAL\Schema\SqliteSchemaManager::listTableDetails" />
417
+ <!--
418
+ TODO: remove in 4.0.0
419
+ -->
420
+ <referencedMethod name =" Doctrine\DBAL\Schema\ColumnDiff::getOldColumnName" />
417
421
</errorLevel >
418
422
</DeprecatedMethod >
419
423
<DeprecatedProperty >
443
447
TODO: remove in 4.0.0
444
448
-->
445
449
<referencedProperty name =" Doctrine\DBAL\Schema\Column::$_customSchemaOptions" />
450
+ <!--
451
+ TODO: remove in 4.0.0
452
+ -->
453
+ <referencedProperty name =" Doctrine\DBAL\Schema\ColumnDiff::$oldColumnName" />
446
454
</errorLevel >
447
455
</DeprecatedProperty >
448
456
<DocblockTypeContradiction >
Original file line number Diff line number Diff line change @@ -642,8 +642,15 @@ public function getAlterTableSQL(TableDiff $diff)
642
642
$ columnArray = $ column ->toArray ();
643
643
644
644
$ columnArray ['comment ' ] = $ this ->getColumnComment ($ column );
645
- $ queryParts [] = 'CHANGE ' . ($ columnDiff ->getOldColumnName ()->getQuotedName ($ this )) . ' '
646
- . $ this ->getColumnDeclarationSQL ($ column ->getQuotedName ($ this ), $ columnArray );
645
+
646
+ if ($ columnDiff ->fromColumn !== null ) {
647
+ $ oldColumn = $ columnDiff ->fromColumn ;
648
+ } else {
649
+ $ oldColumn = $ columnDiff ->getOldColumnName ();
650
+ }
651
+
652
+ $ queryParts [] = 'CHANGE ' . $ oldColumn ->getQuotedName ($ this ) . ' '
653
+ . $ this ->getColumnDeclarationSQL ($ column ->getQuotedName ($ this ), $ columnArray );
647
654
}
648
655
649
656
foreach ($ diff ->renamedColumns as $ oldColumnName => $ column ) {
Original file line number Diff line number Diff line change @@ -561,8 +561,15 @@ public function getAlterTableSQL(TableDiff $diff)
561
561
continue ;
562
562
}
563
563
564
- $ oldColumnName = $ columnDiff ->getOldColumnName ()->getQuotedName ($ this );
565
- $ column = $ columnDiff ->column ;
564
+ if ($ columnDiff ->fromColumn !== null ) {
565
+ $ oldColumn = $ columnDiff ->fromColumn ;
566
+ } else {
567
+ $ oldColumn = $ columnDiff ->getOldColumnName ();
568
+ }
569
+
570
+ $ oldColumnName = $ oldColumn ->getQuotedName ($ this );
571
+
572
+ $ column = $ columnDiff ->column ;
566
573
567
574
if (
568
575
$ columnDiff ->hasChanged ('type ' )
Original file line number Diff line number Diff line change @@ -590,9 +590,15 @@ public function getAlterTableSQL(TableDiff $diff)
590
590
$ requireDropDefaultConstraint = $ this ->alterColumnRequiresDropDefaultConstraint ($ columnDiff );
591
591
592
592
if ($ requireDropDefaultConstraint ) {
593
+ if ($ columnDiff ->fromColumn !== null ) {
594
+ $ oldColumnName = $ columnDiff ->fromColumn ->getName ();
595
+ } else {
596
+ $ oldColumnName = $ columnDiff ->oldColumnName ;
597
+ }
598
+
593
599
$ queryParts [] = $ this ->getAlterTableDropDefaultConstraintClause (
594
600
$ diff ->name ,
595
- $ columnDiff -> oldColumnName
601
+ $ oldColumnName
596
602
);
597
603
}
598
604
Original file line number Diff line number Diff line change 11
11
*/
12
12
class ColumnDiff
13
13
{
14
- /** @var string */
14
+ /**
15
+ * @deprecated Use {@see $fromColumn} and {@see Column::getName()} instead.
16
+ *
17
+ * @var string
18
+ */
15
19
public $ oldColumnName ;
16
20
17
21
/** @var Column */
@@ -61,12 +65,20 @@ public function hasChanged($propertyName)
61
65
}
62
66
63
67
/**
68
+ * @deprecated Use {@see $fromColumn} instead.
69
+ *
64
70
* @return Identifier
65
71
*/
66
72
public function getOldColumnName ()
67
73
{
68
- $ quote = $ this ->fromColumn !== null && $ this ->fromColumn ->isQuoted ();
74
+ if ($ this ->fromColumn !== null ) {
75
+ $ name = $ this ->fromColumn ->getName ();
76
+ $ quote = $ this ->fromColumn ->isQuoted ();
77
+ } else {
78
+ $ name = $ this ->oldColumnName ;
79
+ $ quote = false ;
80
+ }
69
81
70
- return new Identifier ($ this -> oldColumnName , $ quote );
82
+ return new Identifier ($ name , $ quote );
71
83
}
72
84
}
You can’t perform that action at this time.
0 commit comments