<?php

class m130913_090237_custom_fields_on_vehicle_trace extends MyDbMigration
{
	public function up()
	{
		if ($this->dbConnection->schema->getTable('vehicletracetable')->getColumn('custom_vehicle_type') == null)
			$this->addColumn('vehicletracetable', 'custom_vehicle_type', 'string');
		
		if ($this->dbConnection->schema->getTable('vehicletracetable')->getColumn('custom_nationality') == null)
			$this->addColumn('vehicletracetable', 'custom_nationality', 'string');
	}

	public function down()
	{
		if ($this->dbConnection->schema->getTable('vehicletracetable')->getColumn('custom_vehicle_type') != null)
			$this->dropColumn('vehicletracetable', 'custom_vehicle_type');

		if ($this->dbConnection->schema->getTable('vehicletracetable')->getColumn('custom_nationality') != null)
			$this->dropColumn('vehicletracetable', 'custom_nationality');
		
		return true;
	}

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

	public function safeDown()
	{
	}
	*/
}