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

m130721_103024_add_settings_table::down()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 1
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 3
rs 10
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
}