SO GOT THE DATABSE RUNNING AND INSTALLED FOR V5.7.5 JUST HAVING FEW FRONT END ISSUES BUT HOPE FULL GET THERE
Code:
<?php
// New Tables
self::$db->query_write("
CREATE TABLE IF NOT EXISTS `dbtech_vbarcade_access`
(
`accessid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`enabled` tinyint(1) unsigned NOT NULL DEFAULT '1',
`usergroups` text NOT NULL,
`games` text NOT NULL,
`displayorder` int(10) unsigned NOT NULL DEFAULT '10',
`important` tinyint(1) unsigned NOT NULL DEFAULT '0',
`default` tinyint(1) unsigned NOT NULL DEFAULT '0',
`timespan` int(10) unsigned NOT NULL DEFAULT '0',
`mintime` int(10) unsigned NOT NULL DEFAULT '0',
`minposts` int(10) unsigned NOT NULL DEFAULT '0',
`avgposts` double unsigned NOT NULL DEFAULT '0',
`lastposts` int(10) unsigned NOT NULL DEFAULT '0',
`minrep` int(10) unsigned NOT NULL DEFAULT '0',
`earned` tinyint(1) unsigned NOT NULL DEFAULT '0',
`maxplays` int(10) unsigned NOT NULL DEFAULT '0',
`punish` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`accessid`)
) ENGINE=MyISAM
");
self::report('Created Table', 'dbtech_vbarcade_access');
self::$db->query_write("
CREATE TABLE IF NOT EXISTS `dbtech_vbarcade_category`
(
`categoryid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`enabled` tinyint(1) unsigned NOT NULL DEFAULT '1',
`title` varchar(255) NOT NULL,
`displayorder` int(10) unsigned NOT NULL DEFAULT '10',
`password` varchar(255) NOT NULL DEFAULT '',
`usergroups` text NOT NULL,
`icon` varchar(255) NOT NULL DEFAULT '',
`description` text NOT NULL,
PRIMARY KEY (`categoryid`)
) ENGINE=MyISAM
");
self::report('Created Table', 'dbtech_vbarcade_category');
self::$db->query_write("
CREATE TABLE IF NOT EXISTS `dbtech_vbarcade_data`
(
`gameid` varchar(255) NOT NULL,
`local_winner` int(10) unsigned NOT NULL DEFAULT '0',
`global_user` varchar(255) NOT NULL DEFAULT '',
`global_link` varchar(255) NOT NULL DEFAULT '',
`global_score` double NOT NULL DEFAULT '0',
`local_plays` int(10) unsigned NOT NULL DEFAULT '0',
`local_avgscore` double NOT NULL DEFAULT '0',
`local_timespent` int(10) unsigned NOT NULL DEFAULT '0',
`global_plays` int(10) unsigned NOT NULL DEFAULT '0',
`global_avgscore` double NOT NULL DEFAULT '0',
`global_timespent` int(10) unsigned NOT NULL DEFAULT '0',
`ratings` int(10) unsigned NOT NULL DEFAULT '0',
`avgrating` double unsigned NOT NULL DEFAULT '0',
`favorites` int(10) unsigned NOT NULL DEFAULT '0',
`comments` int(10) unsigned NOT NULL DEFAULT '0',
`history_winner` int(10) unsigned NOT NULL DEFAULT '0',
`commentthreadid` int(10) unsigned NOT NULL DEFAULT '0',
`reportthreadid` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`gameid`)
) ENGINE=InnoDB
");
self::report('Created Table', 'dbtech_vbarcade_data');
self::$db->query_write("
CREATE TABLE IF NOT EXISTS `dbtech_vbarcade_favorite`
(
`gameid` varchar(255) NOT NULL,
`userid` int(10) unsigned NOT NULL DEFAULT '0',
`timestamp` int(10) unsigned NOT NULL DEFAULT '0',
UNIQUE KEY `gameid` (`gameid`,`userid`)
) ENGINE=MyISAM
");
self::report('Created Table', 'dbtech_vbarcade_favorite');
self::$db->query_write("
CREATE TABLE IF NOT EXISTS `dbtech_vbarcade_game`
(
`gameid` varchar(255) NOT NULL,
`enabled` tinyint(1) unsigned NOT NULL DEFAULT '1',
`displayorder` int(10) unsigned NOT NULL DEFAULT '10',
`title` varchar(255) NOT NULL,
`description` text NOT NULL,
`instruction` text NOT NULL,
`controls` text NOT NULL,
`keywords` text NOT NULL,
`author` varchar(255) NOT NULL DEFAULT '',
`copyright` varchar(255) NOT NULL DEFAULT '',
`timestamp` int(10) unsigned NOT NULL DEFAULT '0',
`width` double unsigned NOT NULL,
`height` double unsigned NOT NULL,
`decimals` tinyint(2) NOT NULL DEFAULT '0',
`scoring` tinyint(1) unsigned NOT NULL DEFAULT '1',
`tourns` tinyint(1) unsigned NOT NULL DEFAULT '1',
`system` char(3) NOT NULL,
`license` text NOT NULL,
`flashfile` varchar(255) NOT NULL,
`icon` varchar(255) NOT NULL,
`badge` varchar(255) NOT NULL,
PRIMARY KEY (`gameid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
");
self::report('Created Table', 'dbtech_vbarcade_game');
self::$db->query_write("
CREATE TABLE `dbtech_vbarcade_match`
(
`matchid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`tournid` int(10) unsigned NOT NULL DEFAULT '0',
`userid` int(10) unsigned NOT NULL DEFAULT '0',
`against` int(10) unsigned NOT NULL DEFAULT '0',
`score` double NOT NULL DEFAULT '0',
`timestamp` int(10) unsigned NOT NULL DEFAULT '0',
`round` tinyint(2) unsigned NOT NULL DEFAULT '1',
`attempt` tinyint(2) unsigned NOT NULL DEFAULT '0',
`status` tinyint(1) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`matchid`)
) ENGINE=MyISAM
");
self::report('Created Table', 'dbtech_vbarcade_match');
self::$db->query_write("
CREATE TABLE IF NOT EXISTS `dbtech_vbarcade_rating`
(
`gameid` varchar(255) NOT NULL,
`userid` int(10) unsigned NOT NULL DEFAULT '0',
`timestamp` int(10) unsigned NOT NULL DEFAULT '0',
`rating` tinyint(1) unsigned NOT NULL DEFAULT '0',
UNIQUE KEY `gameid` (`gameid`,`userid`)
) ENGINE=MyISAM
");
self::report('Created Table', 'dbtech_vbarcade_rating');
self::$db->query_write("
CREATE TABLE IF NOT EXISTS `dbtech_vbarcade_relation`
(
`gameid` varchar(255) NOT NULL,
`categoryid` int(10) unsigned NOT NULL DEFAULT '0',
UNIQUE KEY `gameid` (`gameid`,`categoryid`)
) ENGINE=MyISAM
");
self::report('Created Table', 'dbtech_vbarcade_relation');
self::$db->query_write("
CREATE TABLE IF NOT EXISTS `dbtech_vbarcade_session`
(
`sessionid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`global` int(10) unsigned NOT NULL DEFAULT '0',
`gameid` varchar(255) NOT NULL,
`label` varchar(255) NOT NULL DEFAULT '',
`userid` int(10) unsigned NOT NULL DEFAULT '0',
`ipaddress` char(15) NOT NULL DEFAULT '',
`timestart` int(10) unsigned NOT NULL DEFAULT '0',
`timefinish` int(10) unsigned NOT NULL DEFAULT '0',
`status` tinyint(1) unsigned NOT NULL DEFAULT '0',
`record` tinyint(1) unsigned NOT NULL DEFAULT '0',
`score` double NOT NULL DEFAULT '0',
`verify` varchar(255) NOT NULL,
`chain` varchar(255) NOT NULL DEFAULT '',
`comment` varchar(255) NOT NULL DEFAULT '',
`matchid` int(10) unsigned NOT NULL DEFAULT '0',
PRIMARY KEY (`sessionid`)
) ENGINE=InnoDB
");
self::report('Created Table', 'dbtech_vbarcade_session');
self::$db->query_write("
CREATE TABLE IF NOT EXISTS `dbtech_vbarcade_tourn`
(
`tournid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`gameid` varchar(255) NOT NULL,
`title` varchar(255) NOT NULL,
`description` text NOT NULL,
`timestamp` int(10) unsigned NOT NULL DEFAULT '0',
`recurring` tinyint(1) unsigned NOT NULL DEFAULT '0',
`private` tinyint(1) unsigned NOT NULL DEFAULT '0',
`usergroups` text NOT NULL,
`status` tinyint(1) unsigned NOT NULL DEFAULT '0',
`winner` int(10) unsigned NOT NULL DEFAULT '0',
`rounds` tinyint(2) unsigned NOT NULL DEFAULT '1',
`attempts` tinyint(2) unsigned NOT NULL DEFAULT '1',
PRIMARY KEY (`tournid`)
) ENGINE=MyISAM
");
self::report('Created Table', 'dbtech_vbarcade_tourn');
// Populate tables
self::$db->query_write("
REPLACE INTO `dbtech_vbarcade_access`
(`accessid`, `enabled`, `usergroups`, `games`, `displayorder`, `important`, `default`, `timespan`, `mintime`, `minposts`, `avgposts`, `lastposts`, `minrep`, `earned`, `maxplays`, `punish`)
VALUES
(1, 1, '', '', 10, 0, 4, 86400, 0, 0, 0, 0, 0, 4, 0, 3)
");
self::report('Populated Table', 'dbtech_vbarcade_access');
self::$db->query_write("
INSERT INTO `dbtech_vbarcade_category`
(`categoryid`, `enabled`, `title`, `displayorder`, `password`, `usergroups`)
VALUES
(1, 1, 'Puzzle', 10, '', ''),
(2, 1, 'Action', 10, '', ''),
(3, 1, 'Retro', 10, '', ''),
(4, 1, 'Sports', 10, '', ''),
(5, 1, 'Shooter', 10, '', ''),
(6, 1, 'RPG', 10, '', ''),
(7, 1, 'Misc', 10, '', '')
");
self::report('Populated Table', 'dbtech_vbarcade_access');
// Add the administrator field
if (self::$db_alter->fetch_table_info('administrator'))
{
self::$db_alter->add_field(array(
'name' => 'arcadepermissions',
'type' => 'int',
'length' => '10',
'attributes' => 'unsigned',
'null' => false, // True = NULL, false = NOT NULL
'default' => '0'
));
self::report('Altered Table', 'administrator');
}
// Add the user field
if (self::$db_alter->fetch_table_info('user'))
{
self::$db_alter->add_field(array(
'name' => 'dbtech_vbarcade_matchcount',
'type' => 'int',
'length' => '10',
'attributes' => 'unsigned',
'null' => false, // True = NULL, false = NOT NULL
'default' => '0'
));
self::report('Altered Table', 'user');
}