| @@ 574-594 (lines=21) @@ | ||
| 571 | $queryParts[] = 'DROP ' . $column->getQuotedName($this); |
|
| 572 | } |
|
| 573 | ||
| 574 | foreach ($diff->changedColumns as $columnDiff) { |
|
| 575 | if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { |
|
| 576 | continue; |
|
| 577 | } |
|
| 578 | ||
| 579 | /* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */ |
|
| 580 | $column = $columnDiff->column; |
|
| 581 | $columnArray = $column->toArray(); |
|
| 582 | ||
| 583 | // Don't propagate default value changes for unsupported column types. |
|
| 584 | if ($columnDiff->hasChanged('default') && |
|
| 585 | count($columnDiff->changedProperties) === 1 && |
|
| 586 | ($columnArray['type'] instanceof TextType || $columnArray['type'] instanceof BlobType) |
|
| 587 | ) { |
|
| 588 | continue; |
|
| 589 | } |
|
| 590 | ||
| 591 | $columnArray['comment'] = $this->getColumnComment($column); |
|
| 592 | $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' |
|
| 593 | . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); |
|
| 594 | } |
|
| 595 | ||
| 596 | foreach ($diff->renamedColumns as $oldColumnName => $column) { |
|
| 597 | if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { |
|
| @@ 503-525 (lines=23) @@ | ||
| 500 | $queryParts[] = 'DROP ' . $column->getQuotedName($this); |
|
| 501 | } |
|
| 502 | ||
| 503 | foreach ($diff->changedColumns as $columnDiff) { |
|
| 504 | if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { |
|
| 505 | continue; |
|
| 506 | } |
|
| 507 | ||
| 508 | /* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */ |
|
| 509 | $column = $columnDiff->column; |
|
| 510 | $columnArray = $column->toArray(); |
|
| 511 | ||
| 512 | // Do not generate column alteration clause if type is binary and only fixed property has changed. |
|
| 513 | // Drizzle only supports binary type columns with variable length. |
|
| 514 | // Avoids unnecessary table alteration statements. |
|
| 515 | if ($columnArray['type'] instanceof BinaryType && |
|
| 516 | $columnDiff->hasChanged('fixed') && |
|
| 517 | count($columnDiff->changedProperties) === 1 |
|
| 518 | ) { |
|
| 519 | continue; |
|
| 520 | } |
|
| 521 | ||
| 522 | $columnArray['comment'] = $this->getColumnComment($column); |
|
| 523 | $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' |
|
| 524 | . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); |
|
| 525 | } |
|
| 526 | ||
| 527 | foreach ($diff->renamedColumns as $oldColumnName => $column) { |
|
| 528 | if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { |
|