m131004_175217_add_ipaddress_column   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 1
Metric Value
eloc 7
dl 0
loc 26
rs 10
c 2
b 0
f 1
wmc 5

4 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 8 2
A getColumnName() 0 3 1
A getColumnType() 0 3 1
A getTableName() 0 3 1
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