<?php

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

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

// Revert
if (self::$db_alter->fetch_table_info('user'))
{
	self::$db_alter->drop_field('dbtech_vbsignatures_signature');
	self::$db_alter->drop_field('dbtech_vbsignatures_configuration');
	self::$db_alter->drop_field('dbtech_vbsignatures_dateline');
	self::$db_alter->drop_field('dbtech_vbsignatures_points');
	self::report('Reverted Table', 'user');
}

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

// Drop
$tables = array(
	'category',
	'font',
	'inventory',
	'layer',
	'part',
	'region',
	'signaturestyle',
);
foreach ($tables as $table)
{
	self::$db->query_write("DROP TABLE IF EXISTS `" . TABLE_PREFIX . "dbtech_vbsignatures_{$table}`");
	self::report('Deleted Table', 'dbtech_vbsignatures_' . $table);
}