| @@ 357-371 (lines=15) @@ | ||
| 354 | /** |
|
| 355 | * {@inheritdoc} |
|
| 356 | */ |
|
| 357 | public function addColumn(Table $table, Column $column) |
|
| 358 | { |
|
| 359 | $sql = sprintf( |
|
| 360 | 'ALTER TABLE %s ADD %s %s;', |
|
| 361 | $this->quoteTableName($table->getName()), |
|
| 362 | $this->quoteColumnName($column->getName()), |
|
| 363 | $this->getColumnSqlDefinition($column) |
|
| 364 | ); |
|
| 365 | ||
| 366 | if ($column->getComment()) { |
|
| 367 | $sql .= $this->getColumnCommentSqlDefinition($column, $table->getName()); |
|
| 368 | } |
|
| 369 | ||
| 370 | $this->execute($sql); |
|
| 371 | } |
|
| 372 | ||
| 373 | /** |
|
| 374 | * {@inheritdoc} |
|
| @@ 418-432 (lines=15) @@ | ||
| 415 | /** |
|
| 416 | * {@inheritdoc} |
|
| 417 | */ |
|
| 418 | public function addColumn(Table $table, Column $column) |
|
| 419 | { |
|
| 420 | $sql = sprintf( |
|
| 421 | 'ALTER TABLE %s ADD %s %s', |
|
| 422 | $this->quoteTableName($table->getName()), |
|
| 423 | $this->quoteColumnName($column->getName()), |
|
| 424 | $this->getColumnSqlDefinition($column) |
|
| 425 | ); |
|
| 426 | ||
| 427 | if ($column->getAfter()) { |
|
| 428 | $sql .= ' AFTER ' . $this->quoteColumnName($column->getAfter()); |
|
| 429 | } |
|
| 430 | ||
| 431 | $this->execute($sql); |
|
| 432 | } |
|
| 433 | ||
| 434 | /** |
|
| 435 | * {@inheritdoc} |
|
| @@ 472-485 (lines=14) @@ | ||
| 469 | /** |
|
| 470 | * {@inheritdoc} |
|
| 471 | */ |
|
| 472 | public function changeColumn($tableName, $columnName, Column $newColumn) |
|
| 473 | { |
|
| 474 | $after = $newColumn->getAfter() ? ' AFTER ' . $this->quoteColumnName($newColumn->getAfter()) : ''; |
|
| 475 | $this->execute( |
|
| 476 | sprintf( |
|
| 477 | 'ALTER TABLE %s CHANGE %s %s %s%s', |
|
| 478 | $this->quoteTableName($tableName), |
|
| 479 | $this->quoteColumnName($columnName), |
|
| 480 | $this->quoteColumnName($newColumn->getName()), |
|
| 481 | $this->getColumnSqlDefinition($newColumn), |
|
| 482 | $after |
|
| 483 | ) |
|
| 484 | ); |
|
| 485 | } |
|
| 486 | ||
| 487 | /** |
|
| 488 | * {@inheritdoc} |
|