<?php
if (self::$db_alter->fetch_table_info('dbtech_vbshop_lottery'))
{
	self::$db_alter->add_field(array(
		'name'       => 'drawnnumbers',
		'type'       => 'MEDIUMTEXT',
		'null'       => true,	// True = NULL, false = NOT NULL
		'default'    => NULL
	));
	self::report('Altered Table', 'dbtech_vbshop_lottery');
}

if (self::$db_alter->fetch_table_info('dbtech_vbshop_bank'))
{
	self::$db_alter->add_field(array(
		'name'       => 'lastinterest',
		'type'       => 'int',
		'length'	 => '10',
		'attributes' => 'unsigned',
		'null'       => false,	// True = NULL, false = NOT NULL
		'default'    => '1'
	));
	self::report('Altered Table', 'dbtech_vbshop_bank');
}

if (self::$db_alter->fetch_table_info('dbtech_vbshop_purchase'))
{
	self::$db->hide_errors();
	self::$db->query_write("ALTER TABLE " . TABLE_PREFIX . "dbtech_vbshop_purchase ADD hidden ENUM('0', '1') NOT NULL DEFAULT '0'");
	self::$db->show_errors();
	self::report('Altered Table', 'dbtech_vbshop_purchase');
}

// Add itemtype table
self::$db->query_write("
	CREATE TABLE IF NOT EXISTS `" . TABLE_PREFIX . "dbtech_vbshop_lotteryticket`
	(
		`lotteryticketid` int(10) unsigned NOT NULL AUTO_INCREMENT,
		`lotteryid` int(10) unsigned NOT NULL DEFAULT '0',
		`userid` int(10) unsigned NOT NULL DEFAULT '0',
		`lotterydraw` int(10) unsigned NOT NULL DEFAULT '0',
		`numbers` mediumtext,
		`prizeid` int(10) unsigned NOT NULL DEFAULT '0',
		PRIMARY KEY (`lotteryticketid`),
		KEY `lotteryid` (`lotteryid`,`userid`),
		KEY `lotteryid_2` (`lotteryid`,`lotterydraw`)
	) ENGINE=MyISAM
");
self::report('Created Table', 'dbtech_vbshop_lotteryticket');