m131004_175217_add_ipaddress_column::up()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 3
c 1
b 0
f 0
nc 2
nop 0
dl 0
loc 8
rs 10
1
<?php
2
3
class m131004_175217_add_ipaddress_column extends AddColumnMigration
4
{
5
6
	protected function getColumnName()
7
	{
8
		return 'source_address';
9
	}
10
11
	protected function getColumnType()
12
	{
13
		return 'VARCHAR(45)';
14
	}
15
16
	protected function getTableName()
17
	{
18
		return 'log';
19
	}
20
	
21
	public function up()
22
	{
23
		// It's okay if the table doesn't exist, it is created correctly the 
24
		// first time the application is run
25
		if (Yii::app()->db->schema->getTable($this->getTableName()) === null)
26
			return;
27
28
		return parent::up();
29
	}
30
31
}
32