Passed
Push — master ( d021a5...a13070 )
by Sam
03:47 queued 12s
created

m130721_103024_add_settings_table   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 13
c 1
b 0
f 1
dl 0
loc 27
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A up() 0 19 2
A down() 0 3 1
1
<?php
2
3
class m130721_103024_add_settings_table extends CDbMigration
4
{
5
6
	public function up()
7
	{
8
		// Don't do anything if the "settings" table already exists
9
		if (Yii::app()->db->schema->getTable('settings') !== null)
10
			return;
11
12
		// Create the "settings" table
13
		$this->createTable('settings', array(
14
			'name'=>'VARCHAR PRIMARY KEY NOT NULL',
15
			'value'=>'VARCHAR NULL'));
16
17
		// Add default values
18
		$this->insert('settings', array(
19
			'name'=>'applicationName',
20
			'value'=>'XBMC Video Server'));
21
		
22
		$this->insert('settings', array(
23
			'name'=>'singleFilePlaylist',
24
			'value'=>'0'));
25
	}
26
27
	public function down()
28
	{
29
		$this->dropTable('settings');
30
	}
31
32
}