SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";


--
-- Database: `spaceusers`
--


DROP TABLE IF Exists `printers`;
CREATE TABLE `printers` (
  `id` int(10) UNSIGNED NOT NULL DEFAULT 0,
  `val` text DEFAULT NULL,
  `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(),
   PRIMARY KEY (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1; 

INSERT INTO `printers` (`id`, `val`, `created`) VALUES
(1, '{\"prntype\":{\"127.0.0.1/till\":1},\"psubst\":{\"T1\":[\"127.0.0.1/till\"]},\"altord\":{\"1\":{},\"2\":{}}}', '2022-10-04 11:46:48');

ALTER TABLE `printers`
  ADD PRIMARY KEY (`id`);
COMMIT; 
CREATE TABLE `settings` (
  `name` varchar(32) NOT NULL,
  `val` varchar(50) NOT NULL DEFAULT '',
  `db` varchar(30) NOT NULL DEFAULT ''
) ENGINE=MyISAM DEFAULT CHARSET=latin1;

DROP TABLE IF EXISTS user_catpermissions;
CREATE TABLE user_catpermissions(
   `id` int(10) unsigned NOT NULL AUTO_INCREMENT,   
   `user_id` int(10) not null default 0,
   `database_name` varchar(50) not null default '',
   `menu_catid` int(10) not null default 0,
   key `users_id`(`user_id`),
   key `menu_cat_usr`(`user_id`,`database_name`,`menu_catid`),
   primary key(`id`)
);
-----===================


--
-- Database: `wcfvm_1`
--
ALTER TABLE  accounts ADD banked tinyint not null default 0;

DROP TABLE nightbridge_invoice;
CREATE TABLE nightbridge_invoice(
   id  int(10) unsigned NOT NULL AUTO_INCREMENT,
   invoice varchar(50) not null default '',
   client int(10) not null default 0,
   created datetime ,
   status tinyint not null default 0,
   primary key `id`(`id`),
   key `created`(`created`)
);
set sql_mode="";
ALTER TABLE tillclients ADD nightsaccountId int(10);
ALTER TABLE tillclients ADD nightsroomId int(10);
ALTER TABLE tillclients ADD `status` enum('OK','PENDING','BANNED') NOT NULL DEFAULT 'OK';
ALTER TABLE tillclients ADD `security_lock` varchar(8) NOT NULL DEFAULT '';
ALTER TABLE tillclients ADD `created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
ALTER TABLE tillclients ADD `lastlogin` datetime NOT NULL DEFAULT '0000-00-00 00:00:00';
ALTER TABLE tillclients ADD `lastip` int(20) unsigned NOT NULL DEFAULT '0';
ALTER TABLE tillclients ADD  key `email`(`email`);

ALTER TABLE tillclients ADD `firstname` varchar(30) NOT NULL default '';
ALTER TABLE tillclients ADD `lastname`  varchar(30) NOT NULL default '';
ALTER TABLE tillclients ADD `city`    varchar(50)  NOT NULL default '';
ALTER TABLE tillclients ADD `state`   varchar(25)   NOT NULL default '';
ALTER TABLE tillclients ADD  `zip`     varchar(15)  NOT NULL default '';
ALTER TABLE tillclients ADD  `country` varchar(50)  NOT NULL default '';
ALTER TABLE tillclients ADD  `flat`    varchar(50) NOT NULL DEFAULT '';
ALTER TABLE tillclients ADD  `options` text;

ALTER TABLE tillclients ADD  `usr_adm`    tinyint not null default 0;
ALTER TABLE menu ADD featured tinyint   default 0;
ALTER TABLE menu ADD popular tinyint   default 0;

ALTER TABLE tillinvoices ADD delivery_fee decimal(10,2) not null default '0.00';
UPDATE branch_documents_details SET vat = 15 WHERE vat is null;

