<?php

class m130130_104923_create_violations_code_table extends MyDbMigration
{
	public function up()
	{
		
		if ($this->dbConnection->schema->getTable('system_status') == null)
		{		
		    $this->createTable('violation_codes', array(
		      'id' => 'pk',
		      'name' => 'string NOT NULL',
		      'id_behaviour' => 'integer NOT NULL'
		    ));
		}
		
    	$this->addColumn('events_behavior', 'id_violation_code', 'integer NOT NULL');
	}

	public function down()
	{
	    $this->dropTable('violation_codes');
	    $this->dropColumn('events_behavior', 'id_violation_code');
	}

}
