@@ 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)) { |
@@ 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)) { |