<?php

class m130903_105520_add_fields_for_speed_signs_and_marks extends MyDbMigration
{
	public function up()
	{
		if ($this->dbConnection->schema->getTable('vehicletracetable')->getColumn('speed_limit_signs') == null)
			$this->addColumn('vehicletracetable', 'speed_limit_signs', 'string');		
		
		if ($this->dbConnection->schema->getTable('vehicletracetable')->getColumn('truck_bar_type') == null)
			$this->addColumn('vehicletracetable', 'truck_bar_type', 'string');
		
		if ($this->dbConnection->schema->getTable('storicotable')->getColumn('speed_limit_signs') == null)
			$this->addColumn('storicotable', 'speed_limit_signs', 'string');
		
		if ($this->dbConnection->schema->getTable('storicotable')->getColumn('truck_bar_type') == null)
			$this->addColumn('storicotable', 'truck_bar_type', 'string');		
	}

	public function down()
	{
		if ($this->dbConnection->schema->getTable('vehicletracetable')->getColumn('speed_limit_signs') != null)
			$this->dropColumn('vehicletracetable', 'speed_limit_signs');
		
		if ($this->dbConnection->schema->getTable('vehicletracetable')->getColumn('truck_bar_type') != null)
			$this->dropColumn('vehicletracetable', 'truck_bar_type');
		
		if ($this->dbConnection->schema->getTable('storicotable')->getColumn('speed_limit_signs') != null)
			$this->dropColumn('storicotable', 'speed_limit_signs');
		
		if ($this->dbConnection->schema->getTable('storicotable')->getColumn('truck_bar_type') != null)
			$this->dropColumn('storicotable', 'truck_bar_type');
		
		return true;
	}

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

	public function safeDown()
	{
	}
	*/
}