Passed
Push — master ( c2d8e3...289151 )
by Jeroen
06:06
created

DropTypeSubtypeFromRiverTable::change()   B

Complexity

Conditions 5
Paths 9

Size

Total Lines 18
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 5
eloc 9
nc 9
nop 0
dl 0
loc 18
rs 8.8571
c 1
b 0
f 0
1
<?php
2
3
use Phinx\Migration\AbstractMigration;
4
5
class DropTypeSubtypeFromRiverTable extends AbstractMigration {
6
	/**
7
	 * Drops type and subtype columns from the river table
8
	 */
9
	public function change() {
10
11
		if ($this->hasTable('river')) {
12
			$table = $this->table('river');
13
14
			if ($table->hasColumn('type')) {
15
				$table->removeColumn('type');
16
			}
17
18
			if ($table->hasColumn('subtype')) {
19
				$table->removeColumn('subtype');
20
			}
21
22
			if ($table->hasColumn('access_id')) {
23
				$table->removeColumn('access_id');
24
			}
25
26
			$table->save();
27
		}
28
	}
29
}
30