INSERT INTO `0_sys_prefs` (`name`, `category`, `type`, `length`) VALUES ('invoice_info', 'glsetup.customer', 'tinytext', '0');

ALTER TABLE `0_debtor_trans_details` 
ADD COLUMN `is_taxed` INT NULL DEFAULT '1' AFTER `src_id`;

ALTER TABLE `0_sales_order_details` 
ADD COLUMN `is_taxed` INT NULL DEFAULT 1 AFTER `discount_percent`;
ALTER TABLE `0_comments` 
CHANGE COLUMN `memo_` `memo_` VARCHAR(6000) CHARACTER SET 'utf8' NULL DEFAULT NULL ;

INSERT INTO `0_sys_prefs` VALUES ('sys_opening_balances_account', 'glsetup.general', 'varchar', 15, '39009');

INSERT INTO `0_sys_prefs` VALUES ('sys_opening_balances_account', 'glsetup.general', 'varchar', 15, '39009');

INSERT INTO `0_reflines` (`trans_type`, `pattern`, `default`, `inactive`) VALUES ('52', '{001}/{YYYY}', '1', '0');
INSERT INTO `0_sys_prefs` VALUES ('waste_stock_id', 'glsetup.items', 'varchar', 15, '1');

CREATE TABLE `0_stock_uom` (
  `stock_id` varchar(20) CHARACTER SET utf8 NOT NULL,
  `uom` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`stock_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;


CREATE TABLE `0_stock_control` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `stock_id` varchar(45) CHARACTER SET utf8 DEFAULT NULL,
  `type` varchar(100) COLLATE utf8_unicode_ci DEFAULT NULL,
  `qty` double DEFAULT NULL,
  `memo` varchar(500) COLLATE utf8_unicode_ci DEFAULT NULL,
  `trans_date` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `trans_no` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `reference` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `loc_code` varchar(45) COLLATE utf8_unicode_ci DEFAULT NULL,
  `timestamp` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

CREATE TABLE `0_payment_modes` (
  `id` INT NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(70) NULL,
  `banks` VARCHAR(45) NULL,
  `timestamp` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP,
  `inactive` INT NULL,
  PRIMARY KEY (`id`));

ALTER TABLE `0_bank_trans` 
ADD COLUMN `payment_mode` VARCHAR(45) NULL AFTER `reconciled`;
ALTER TABLE `0_bank_trans` 
ADD COLUMN `bank_ref` VARCHAR(150) NULL AFTER `payment_mode`;

ALTER TABLE `0_purch_data` 
ADD COLUMN `lower_qty` DOUBLE NULL AFTER `supplier_description`,
ADD COLUMN `upper_qty` DOUBLE NULL AFTER `lower_qty`;

ALTER TABLE `0_purch_data` 
CHANGE COLUMN `lower_qty` `lower_qty` DOUBLE NULL DEFAULT 0 ,
CHANGE COLUMN `upper_qty` `upper_qty` DOUBLE NULL DEFAULT 0 ,
DROP PRIMARY KEY;

ALTER TABLE `0_purch_data` 
ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST,
ADD PRIMARY KEY (`id`);

ALTER TABLE `0_stock_master` 
ADD COLUMN `weight` DOUBLE NULL AFTER `fa_class_id`;

ALTER TABLE `0_debtor_trans_details` 
ADD COLUMN `weight` DOUBLE NULL AFTER `is_taxed`;

ALTER TABLE `0_employee` 
ADD COLUMN `nhif_no` VARCHAR(45) NULL AFTER `inactive`,
ADD COLUMN `nssf_no` VARCHAR(45) NULL AFTER `nhif_no`;