<?php

// Revert
if (self::$db_alter->fetch_table_info('administrator'))
{
	self::$db_alter->drop_field('dbtech_vbshopadminperms');
	self::report('Reverted Table', 'administrator');
}

// Clean up
self::$db->query_write("DELETE FROM `" . TABLE_PREFIX . "datastore` WHERE `title` LIKE 'dbtech_vbshop_%'");
self::report('Reverted Table', 'datastore');

// Revert
if (self::$db_alter->fetch_table_info('user'))
{
	self::$db_alter->drop_field(array(
		'dbtech_vbshop_bank',
		'dbtech_vbshop_points',
		'dbtech_vbshop_purchase',
		'dbtech_vbshop_immunity',
		'dbtech_vbshop_usernamestyle',
		'dbtech_vbshop_usertitlestyle',
	));
	self::report('Reverted Table', 'user');
}

// Revert
if (self::$db_alter->fetch_table_info('usergroup'))
{
	self::$db_alter->drop_field('dbtech_vbshoppermissions');
	self::report('Reverted Table', 'usergroup');
}

// Drop
$tables = array(
	'bank',
	'category',
	'currency',
	'donationlog',
	'feedback',
	'item',
	'itemtype',
	'lottery',
	'lotteryprize',
	'lotteryticket',
	'purchase',
	'shop',
	'shopinventory',
	'shoppingcart',
	'threadban',
	'transactionlog',
);
foreach ($tables as $table)
{
	self::$db->query_write("DROP TABLE IF EXISTS `" . TABLE_PREFIX . "dbtech_vbshop_{$table}`");
	self::report('Deleted Table', 'dbtech_vbshop_' . $table);
}