| @@ 511-533 (lines=23) @@ | ||
| 508 | $queryParts[] = 'DROP ' . $column->getQuotedName($this); |
|
| 509 | } |
|
| 510 | ||
| 511 | foreach ($diff->changedColumns as $columnDiff) { |
|
| 512 | if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { |
|
| 513 | continue; |
|
| 514 | } |
|
| 515 | ||
| 516 | /* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */ |
|
| 517 | $column = $columnDiff->column; |
|
| 518 | $columnArray = $column->toArray(); |
|
| 519 | ||
| 520 | // Do not generate column alteration clause if type is binary and only fixed property has changed. |
|
| 521 | // Drizzle only supports binary type columns with variable length. |
|
| 522 | // Avoids unnecessary table alteration statements. |
|
| 523 | if ($columnArray['type'] instanceof BinaryType && |
|
| 524 | $columnDiff->hasChanged('fixed') && |
|
| 525 | count($columnDiff->changedProperties) === 1 |
|
| 526 | ) { |
|
| 527 | continue; |
|
| 528 | } |
|
| 529 | ||
| 530 | $columnArray['comment'] = $this->getColumnComment($column); |
|
| 531 | $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' |
|
| 532 | . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); |
|
| 533 | } |
|
| 534 | ||
| 535 | foreach ($diff->renamedColumns as $oldColumnName => $column) { |
|
| 536 | if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { |
|
| @@ 586-607 (lines=22) @@ | ||
| 583 | $queryParts[] = 'DROP ' . $column->getQuotedName($this); |
|
| 584 | } |
|
| 585 | ||
| 586 | foreach ($diff->changedColumns as $columnDiff) { |
|
| 587 | if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { |
|
| 588 | continue; |
|
| 589 | } |
|
| 590 | ||
| 591 | /* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */ |
|
| 592 | $column = $columnDiff->column; |
|
| 593 | $columnArray = $column->toArray(); |
|
| 594 | ||
| 595 | // Don't propagate default value changes for unsupported column types. |
|
| 596 | if ($columnDiff->hasChanged('default') && |
|
| 597 | count($columnDiff->changedProperties) === 1 && |
|
| 598 | !$this->isDefaultValueSupportedForType($columnArray['type']) |
|
| 599 | ) { |
|
| 600 | continue; |
|
| 601 | } |
|
| 602 | ||
| 603 | $columnArray['comment'] = $this->getColumnComment($column); |
|
| 604 | $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' |
|
| 605 | . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); |
|
| 606 | } |
|
| 607 | ||
| 608 | foreach ($diff->renamedColumns as $oldColumnName => $column) { |
|
| 609 | if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { |
|
| 610 | continue; |
|