<?php

class m161230_081049_add_plate_authorization_actions_table extends MyDbMigration
{
	public function up()
	{
		$this->createTableIfNotExists ( 'plate_authorization_action' );
		$this->addColumn ( 'plate_authorization_action', 'id', 'BIGINT(20)  NOT NULL auto_increment' );
		$this->addColumn ( 'plate_authorization_action', 'id_plate_authorization', 'BIGINT(20)  NOT NULL' );
		$this->addColumn ( 'plate_authorization_action', 'id_user', 'BIGINT(20)  NOT NULL' );
		$this->addColumn ( 'plate_authorization_action', 'epoch', 'DATETIME NOT NULL' );
		$this->addColumn ( 'plate_authorization_action', 'action', 'CHAR(32)' );
		$this->addColumn ( 'plate_authorization_action', 'note', 'VARCHAR(500)' );
		$this->addColumn ( 'plate_authorization_action', 'list_code', 'BIGINT(20)' );
		
		$this->addColumn ( 'whitelisttable', 'request_code', 'CHAR(32)' );
		$this->addColumn ( 'whitelisttable', 'authorization_code', 'CHAR(32)' );
		$this->addColumn ( 'whitelisttable', 'path', 'TEXT' );
		
		$this->addColumn ( 'usertable', 'personal_id_code', 'CHAR(32)' );
		

	}

	public function down()
	{
		$this->dropTableIfExists ( 'plate_authorization_action' );
		
		$this->dropColumn ( 'whitelisttable', 'request_code' );
		$this->dropColumn ( 'whitelisttable', 'authorization_code' );
		$this->dropColumn ( 'whitelisttable', 'path' );
		
		$this->dropColumn ( 'usertable', 'personal_id_code' );
		
		
		return true;
	}

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

	public function safeDown()
	{
	}
	*/
}