Conditions | 3 |
Paths | 3 |
Total Lines | 19 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
45 | public function execute(CapsuleInterface $capsule) |
||
46 | { |
||
47 | $schema = $capsule->getSchema($this->getTable(), $this->getDatabase()); |
||
48 | |||
49 | if (!$schema->hasColumn($this->name)) { |
||
50 | throw new ColumnException( |
||
51 | "Unable to drop column '{$schema->getName()}'.'{$this->name}', column does not exists" |
||
52 | ); |
||
53 | } |
||
54 | |||
55 | if ($schema->hasColumn($this->newName)) { |
||
56 | throw new ColumnException( |
||
57 | "Unable to rename column '{$schema->getName()}'.'{$this->name}', column '{$this->newName}' already exists" |
||
58 | ); |
||
59 | } |
||
60 | |||
61 | //Declaring column |
||
62 | $schema->renameColumn($this->name, $this->newName); |
||
63 | } |
||
64 | } |