@@ 524-546 (lines=23) @@ | ||
521 | $queryParts[] = 'DROP ' . $column->getQuotedName($this); |
|
522 | } |
|
523 | ||
524 | foreach ($diff->changedColumns as $columnDiff) { |
|
525 | if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) { |
|
526 | continue; |
|
527 | } |
|
528 | ||
529 | /* @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */ |
|
530 | $column = $columnDiff->column; |
|
531 | $columnArray = $column->toArray(); |
|
532 | ||
533 | // Do not generate column alteration clause if type is binary and only fixed property has changed. |
|
534 | // Drizzle only supports binary type columns with variable length. |
|
535 | // Avoids unnecessary table alteration statements. |
|
536 | if ($columnArray['type'] instanceof BinaryType && |
|
537 | $columnDiff->hasChanged('fixed') && |
|
538 | count($columnDiff->changedProperties) === 1 |
|
539 | ) { |
|
540 | continue; |
|
541 | } |
|
542 | ||
543 | $columnArray['comment'] = $this->getColumnComment($column); |
|
544 | $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' ' |
|
545 | . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray); |
|
546 | } |
|
547 | ||
548 | foreach ($diff->renamedColumns as $oldColumnName => $column) { |
|
549 | if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) { |
@@ 586-606 (lines=21) @@ | ||
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 | ($columnArray['type'] instanceof TextType || $columnArray['type'] instanceof BlobType) |
|
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)) { |