<?php

class m130919_054729_add_violation_doc_extra extends MyDbMigration
{
	public function up()
	{
		if ($this->dbConnection->schema->getTable('violation_document')->getColumn('document_ext') == null)
			$this->addColumn('violation_document', 'document_ext', 'mediumblob');

		if ($this->dbConnection->schema->getTable('violation_document')->getColumn('document_ext_size') == null)
			$this->addColumn('violation_document', 'document_ext_size', 'bigint(20)');

		if ($this->dbConnection->schema->getTable('violation_document')->getColumn('document_ext_filename') == null)
			$this->addColumn('violation_document', 'document_ext_filename', 'char(250)');
	}

	public function down()
	{
		if ($this->dbConnection->schema->getTable('violation_document')->getColumn('document_ext') != null)
			$this->dropColumn('violation_document', 'document_ext');
		
		if ($this->dbConnection->schema->getTable('violation_document')->getColumn('document_ext') != null)
			$this->dropColumn('violation_document', 'document_ext_size');
		
		if ($this->dbConnection->schema->getTable('violation_document')->getColumn('document_ext') != null)
			$this->dropColumn('violation_document', 'document_ext_filename');
		
		
		return true;
	}

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

	public function safeDown()
	{
	}
	*/
}