| @@ 26-42 (lines=17) @@ | ||
| 23 | /** |
|
| 24 | * {@inheritdoc} |
|
| 25 | */ |
|
| 26 | public function alterColumn( |
|
| 27 | AbstractTable $table, |
|
| 28 | AbstractColumn $initial, |
|
| 29 | AbstractColumn $column |
|
| 30 | ) { |
|
| 31 | $query = "ALTER TABLE {table} CHANGE {column} {statement}"; |
|
| 32 | ||
| 33 | $query = \Spiral\interpolate($query, [ |
|
| 34 | 'table' => $table->getName(true), |
|
| 35 | 'column' => $initial->getName(true), |
|
| 36 | 'statement' => $column->sqlStatement() |
|
| 37 | ]); |
|
| 38 | ||
| 39 | $this->run($query); |
|
| 40 | ||
| 41 | return $this; |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * {@inheritdoc} |
|
| @@ 57-68 (lines=12) @@ | ||
| 54 | /** |
|
| 55 | * {@inheritdoc} |
|
| 56 | */ |
|
| 57 | public function alterIndex(AbstractTable $table, AbstractIndex $initial, AbstractIndex $index) |
|
| 58 | { |
|
| 59 | $query = \Spiral\interpolate("ALTER TABLE {table} DROP INDEX {index}, ADD {statement}", [ |
|
| 60 | 'table' => $table->getName(true), |
|
| 61 | 'index' => $initial->getName(true), |
|
| 62 | 'statement' => $index->sqlStatement(false) |
|
| 63 | ]); |
|
| 64 | ||
| 65 | $this->run($query); |
|
| 66 | ||
| 67 | return $this; |
|
| 68 | } |
|
| 69 | ||
| 70 | /** |
|
| 71 | * {@inheritdoc} |
|