<?php

class m130814_160106_system_status_table extends MyDbMigration
{
	public function up()
	{
		if ($this->dbConnection->schema->getTable('system_status') == null)
		{
			$this->createTable('system_status',
					array('id' => 'pk',
							'name' 									 => 'varchar(255)',
							'description'   				 => 'varchar(255)',
							'status'  							 => 'varchar(255)',
							'last_update'					   => 'datetime',
							'update_timeout'				 => 'time',
							'last_error_log'				 => 'varchar(255)',
							'system_runnning'				 => 'boolean',
							'epoch'      						 => 'datetime',
			
					),
					'ENGINE=MyISAM'
				);
			
			$this->insert('system_status', array("name" => "SYSTEM", "description" => "SYSTEM", "status" => 'alive', 'last_update'=>'2013-08-14 12:00:000', 'update_timeout' => '600', 'system_runnning'=>1, 'epoch'=>'2013-08-14 12:00:000'));
			$this->insert('system_status', array("name" => "SCNTT", "description" => "SCNTT", "status" => 'dead', 'last_update'=>'2013-08-14 12:00:000', 'update_timeout' => '600', 'system_runnning'=>0, 'epoch'=>'2013-08-14 12:00:000'));
		}
		
		
	}

	public function down()
	{
		$this->dropTable('system_status', 'description');
		
		return true;
	}

	/*
	// Use safeUp/safeDown to do migration with transaction
	public function safeUp()
	{
	}

	public function safeDown()
	{
	}
	*/
}