<?php

class m130616_142857_custom_vehcile_plate_type extends MyDbMigration
{
	public function up()
	{
		if ($this->dbConnection->schema->getTable('storicotable')->getColumn('custom_plate_type') == null)
			$this->addColumn('storicotable', 'custom_plate_type', 'string');
		
		if ($this->dbConnection->schema->getTable('storicotable')->getColumn('custom_vehicle_property') == null)
			$this->addColumn('storicotable', 'custom_vehicle_property', 'string');
		
		$this->createNonExistingTable('custom_property_type',
					      array(
					        'id' => 'pk',
					        'type' => 'string',
					        'label' => 'string',
					        'description' => 'string',
 							'is_default'     => 'bool'
					      ),
					      'ENGINE=MyISAM'
					    );
		
		$this->createNonExistingTable('custom_plate_type',
				array(
						'id' => 'pk',
						'type' => 'string',
						'label' => 'string',
						'description' => 'string',
						'is_default'     => 'bool'
				),
				'ENGINE=MyISAM'
		);
    }

	public function down()
	{
//		$this->dropColumn('storicotable', 'custom_plate_type');
//		$this->dropColumn('storicotable', 'custom_property_type');
		
		$this->dropTable('custom_property_type');
		$this->dropTable('custom_plate_type');
		
		
		return true;
	}

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

	public function safeDown()
	{
	}
	*/
}