+DROP TABLE IF EXISTS `0_attachments`;
+
+CREATE TABLE `0_attachments` (
+ `id` int(11) UNSIGNED NOT NULL auto_increment,
+ `description` varchar(60) NOT NULL default '',
+ `type_no` int(11) NOT NULL default '0',
+ `trans_no` int(11) NOT NULL default '0',
+ `unique_name` varchar(60) NOT NULL default '',
+ `tran_date` date NOT NULL default '0000-00-00',
+ `filename` varchar(60) NOT NULL default '',
+ `filesize` int(11) NOT NULL default '0',
+ `filetype` varchar(60) NOT NULL default '',
+ PRIMARY KEY (`id`),
+ KEY `type_no` (`type_no`,`trans_no`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+DROP TABLE IF EXISTS `0_groups`;
+
+CREATE TABLE `0_groups` (
+ `id` smallint(6) UNSIGNED NOT NULL auto_increment,
+ `description` varchar(60) NOT NULL default '',
+ `inactive` tinyint(1) NOT NULL default 0,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `description` (`description`)
+) TYPE=MyISAM AUTO_INCREMENT=1 ;
+
+INSERT INTO `0_groups` VALUES ('1', 'Small', '0');
+INSERT INTO `0_groups` VALUES ('2', 'Medium', '0');
+INSERT INTO `0_groups` VALUES ('3', 'Large', '0');
+
+DROP TABLE IF EXISTS `0_recurrent_invoices`;
+
+CREATE TABLE `0_recurrent_invoices` (
+ `id` smallint(6) UNSIGNED NOT NULL auto_increment,
+ `description` varchar(60) NOT NULL default '',
+ `order_no` int(11) UNSIGNED NOT NULL,
+ `debtor_no` int(11) UNSIGNED NULL default NULL,
+ `group_no` smallint(6) UNSIGNED NULL default NULL,
+ `days` int(11) NOT NULL default '0',
+ `monthly` int(11) NOT NULL default '0',
+ `begin` date NOT NULL default '0000-00-00',
+ `end` date NOT NULL default '0000-00-00',
+ `last_sent` date NOT NULL default '0000-00-00',
+ PRIMARY KEY (`id`),
+ UNIQUE KEY `description` (`description`)
+) TYPE=InnoDB AUTO_INCREMENT=1 ;
+
+ALTER TABLE `0_cust_branch` ADD `group_no` int(11) NOT NULL default '0';
+
+ALTER TABLE `0_debtor_trans` ADD `dimension_id` int(11) NOT NULL default '0';
+ALTER TABLE `0_debtor_trans` ADD `dimension2_id` int(11) NOT NULL default '0';
+
+ALTER TABLE `0_bank_accounts` DROP PRIMARY KEY;
+ALTER TABLE `0_bank_accounts` ADD `id` SMALLINT(6) AUTO_INCREMENT PRIMARY KEY;
+ALTER TABLE `0_bank_accounts` ADD `last_reconciled_date` timestamp NOT NULL default '0000-00-00';
+ALTER TABLE `0_bank_accounts` ADD `ending_reconcile_balance` double NOT NULL default '0';
+
+ALTER TABLE `0_bank_trans` DROP COLUMN `bank_trans_type_id`;
+ALTER TABLE `0_bank_trans` ADD `reconciled` date default NULL;
+
+ALTER TABLE `0_users` ADD `query_size` TINYINT(1) DEFAULT '10';
+
+ALTER TABLE `0_users` ADD `graphic_links` TINYINT(1) DEFAULT '1';
+
+DROP TABLE IF EXISTS `0_sales_pos`;
+
+CREATE TABLE `0_sales_pos` (
+ `id` smallint(6) UNSIGNED NOT NULL auto_increment,
+ `pos_name` varchar(30) NOT NULL,
+ `cash_sale` tinyint(1) NOT NULL,
+ `credit_sale` tinyint(1) NOT NULL,
+ `pos_location` varchar(5) NOT NULL,
+ `pos_account` smallint(6) UNSIGNED NOT NULL,
+ `inactive` tinyint(1) NOT NULL default 0,
+ PRIMARY KEY (`id`),
+ UNIQUE KEY(`pos_name`)
+) TYPE=MyISAM AUTO_INCREMENT=1;
+
+# After upgrade default POS cash sale is off. Change in POS setup if you wish.
+INSERT INTO `0_sales_pos` VALUES ('1', 'Default', '0', '1', 'DEF', '1', '0');
+
+ALTER TABLE `0_users` ADD `pos` SMALLINT(6) DEFAULT '1';
+
+DROP TABLE IF EXISTS `0_quick_entries`;
+
+CREATE TABLE `0_quick_entries` (
+ `id` smallint(6) UNSIGNED NOT NULL auto_increment,
+ `type` tinyint(1) NOT NULL default '0',
+ `description` varchar(60) NOT NULL,
+ `base_amount` double NOT NULL default '0',
+ `base_desc` varchar(60) NULL,
+ PRIMARY KEY (`id`),
+ KEY `description` (`description`)
+) TYPE=MyISAM AUTO_INCREMENT=1;
+
+INSERT INTO `0_quick_entries` VALUES ('1', '1', 'Maintenance', '0', 'Amount');
+INSERT INTO `0_quick_entries` VALUES ('2', '1', 'Phone', '0', 'Amount');
+INSERT INTO `0_quick_entries` VALUES ('3', '2', 'Cash Sales', '0', 'Amount');
+
+DROP TABLE IF EXISTS `0_quick_entry_lines`;
+
+CREATE TABLE `0_quick_entry_lines` (
+ `id` smallint(6) UNSIGNED NOT NULL auto_increment,
+ `qid` smallint(6) UNSIGNED NOT NULL,
+ `amount` double default NULL default '0',
+ `action` varchar(2) NOT NULL,
+ `dest_id` varchar(11) NOT NULL,
+ `dimension_id` smallint(6) UNSIGNED NULL default NULL,
+ `dimension2_id` smallint(6) UNSIGNED NULL default NULL,
+ PRIMARY KEY (`id`),
+ KEY `qid` (`qid`)
+) TYPE=MyISAM AUTO_INCREMENT=1;
+
+INSERT INTO `0_quick_entry_lines` VALUES ('1', '1','0','=', '6600', '0', '0');
+INSERT INTO `0_quick_entry_lines` VALUES ('2', '2','0','=', '6730', '0', '0');
+INSERT INTO `0_quick_entry_lines` VALUES ('3', '3','0','=', '3000', '0', '0');
+
+ALTER TABLE `0_users` ADD `print_profile` VARCHAR(30) NOT NULL DEFAULT '1';
+ALTER TABLE `0_users` ADD `rep_popup` TINYINT(1) DEFAULT '1';