<?php
require_once(dirname(__FILE__).'/../../upgrade.php');
class create_question_auth_table extends UPGRADE
{
	/**
	* IsAlreadyUpgraded
	* Do we need to run this classes upgrade script or not ?
	*
	* @return bool true if the upgrade has already run, otherwise false
	*/
	function IsAlreadyUpgraded()
	{
		return $this->TableExists($GLOBALS['tablePrefix'].'question_auth');
	}

	/**
	* Upgrade
	* Do the actual upgrade of this component. If this is successful all
	* subsequent calls to IsAlreadyUpgraded should return true
	*
	* @return void
	*/
	function Upgrade()
	{
		$query = '
			CREATE TABLE `'.$GLOBALS['tablePrefix'].'question_auth` (
			`questionauthid` int(11) NOT NULL auto_increment,
			`questionid` int(11) NOT NULL,
			`groupid` int(11) NOT NULL,
			PRIMARY KEY  (`questionauthid`),
			UNIQUE KEY `questionid` (`questionid`,`groupid`),
			KEY `groupid` (`groupid`)
			);
		';

		$result = $GLOBALS['AKB_DB']->Query($query);
	}

}
?>
