*** empty log message ***
[fa-stable.git] / sql / alter2.1.sql
1 DROP TABLE IF EXISTS `0_groups`;
2
3 CREATE TABLE `0_groups` (
4   `id` int(11) NOT NULL auto_increment,
5   `description` varchar(60) NOT NULL default '',
6   PRIMARY KEY  (`id`),
7   UNIQUE KEY `description` (`description`)
8 ) TYPE=MyISAM AUTO_INCREMENT=1 ;
9
10 INSERT INTO `0_groups` VALUES ('1', 'Small');
11 INSERT INTO `0_groups` VALUES ('2', 'Medium');
12 INSERT INTO `0_groups` VALUES ('3', 'Large');
13
14 DROP TABLE IF EXISTS `0_recurrent_invoices`;
15
16 CREATE TABLE `0_recurrent_invoices` (
17   `id` int(11) NOT NULL auto_increment,
18   `description` varchar(60) NOT NULL default '',
19   `order_no` int(11) NOT NULL default '0',
20   `debtor_no` int(11) NOT NULL default '0',
21   `group_no` int(11) NOT NULL default '0',
22   `days` int(11) NOT NULL default '0',
23   `monthly` int(11) NOT NULL default '0',
24   `begin` date NOT NULL default '0000-00-00',
25   `end` date NOT NULL default '0000-00-00',
26   `last_sent` date NOT NULL default '0000-00-00',
27   PRIMARY KEY  (`id`),
28   UNIQUE KEY `description` (`description`)
29 ) TYPE=InnoDB AUTO_INCREMENT=1 ;
30
31 ALTER TABLE `0_cust_branch` ADD `group_no` int(11) NOT NULL default '0';
32
33 ALTER TABLE `0_debtor_trans` ADD `dimension_id` int(11) NOT NULL default '0';
34 ALTER TABLE `0_debtor_trans` ADD `dimension2_id` int(11) NOT NULL default '0';
35
36 DROP TABLE IF EXISTS `0_bank_trans_types`;
37
38 ALTER TABLE `0_bank_accounts` DROP PRIMARY KEY;
39 ALTER TABLE `0_bank_accounts` ADD `id` SMALLINT(6) AUTO_INCREMENT PRIMARY KEY;
40 ALTER TABLE `0_bank_accounts` ADD KEY (`account_code`);
41
42 # Version for any MySQL but usable with digital only gl account codes:
43 # UPDATE 0_bank_accounts SET id = account_code;
44 # For any Applicable only to  MySQL >=4.0.4 :
45 UPDATE `0_bank_trans`, `0_bank_accounts` SET 0_bank_trans.bank_act=0_bank_accounts.id 
46         WHERE 0_bank_trans.bank_act=0_bank_accounts.account_code; 
47
48
49 ALTER TABLE `0_users` ADD `query_size` TINYINT(1) DEFAULT '10';
50
51 DROP TABLE IF EXISTS `0_sales_pos`;
52
53 CREATE TABLE `0_sales_pos` (
54   `id` smallint(6) NOT NULL auto_increment,
55   `pos_name` varchar(30) NOT NULL,
56   `cash_sale` tinyint(1) NOT NULL,
57   `credit_sale` tinyint(1) NOT NULL,
58   `pos_location` varchar(5) NOT NULL,
59   `pos_account` varchar(11) NOT NULL,
60   PRIMARY KEY  (`id`),
61   UNIQUE KEY(`pos_name`)
62 ) TYPE=MyISAM AUTO_INCREMENT=1;
63
64 INSERT INTO `0_sales_pos` VALUES ('1', 'Default', '1', '1', 'DEF', '1');
65
66 ALTER TABLE `0_users` ADD `pos` SMALLINT(6) DEFAULT '1';
67
68 DROP TABLE IF EXISTS `0_quick_entries`;
69
70 CREATE TABLE `0_quick_entries` (
71   `id` smallint(6) NOT NULL auto_increment,
72   `description` varchar(60) NOT NULL,
73   `deposit` tinyint(1) NOT NULL default '0',
74   `bank_only` tinyint(1) NOT NULL default '0',
75   PRIMARY KEY  (`id`),
76   KEY `description` (`description`)
77 ) TYPE=MyISAM AUTO_INCREMENT=1;
78
79 INSERT INTO `0_quick_entries` VALUES ('1', 'Maintenance', '0', '1');
80 INSERT INTO `0_quick_entries` VALUES ('2', 'Phone', '0', '1');
81 INSERT INTO `0_quick_entries` VALUES ('3', 'Cash Sales', '1', '1');
82
83 DROP TABLE IF EXISTS `0_quick_entry_lines`;
84
85 CREATE TABLE `0_quick_entry_lines` (
86   `id` smallint(6) NOT NULL auto_increment,
87   `qid` smallint(6) NOT NULL,
88   `account` varchar(11) NOT NULL,
89   `tax_acc` tinyint(1) NOT NULL default '0',
90   `pct` tinyint(1) NOT NULL default '0',
91   `amount` double default NULL default '0',
92   `dimension_id` int(11) NOT NULL default '0',
93   `dimension2_id` int(11) NOT NULL default '0',
94   PRIMARY KEY  (`id`),
95   KEY `qid` (`qid`)
96 ) TYPE=MyISAM AUTO_INCREMENT=1;
97
98 INSERT INTO `0_quick_entry_lines` VALUES ('1', '1', '6600', '1', '0', 0, '0', '0');
99 INSERT INTO `0_quick_entry_lines` VALUES ('2', '2', '6730', '1', '0', 0, '0', '0');
100 INSERT INTO `0_quick_entry_lines` VALUES ('3', '3', '3000', '1', '0', 0, '0', '0');
101
102 ALTER TABLE `0_users` ADD `print_profile` VARCHAR(30) DEFAULT '' AFTER `show_hints` ;
103 ALTER TABLE `0_users` ADD `rep_popup` TINYINT(1) DEFAULT '1' AFTER `print_profile` ;
104
105 DROP TABLE IF EXISTS `0_print_profiles`;
106 CREATE TABLE `0_print_profiles` (
107   `id` tinyint(11) NOT NULL auto_increment,
108   `profile` varchar(30) NOT NULL,
109   `report` varchar(5) NOT NULL,
110   `printer` tinyint(5) NOT NULL,
111   PRIMARY KEY  (`id`),
112   UNIQUE KEY `profile` (`profile`,`report`)
113 ) TYPE=MyISAM AUTO_INCREMENT=10;
114
115 INSERT INTO `0_print_profiles` VALUES ('1', 'Out of office', '', '0');
116 INSERT INTO `0_print_profiles` VALUES ('2', 'Sales Department', '', '0');
117 INSERT INTO `0_print_profiles` VALUES ('3', 'Central', '', '2');
118 INSERT INTO `0_print_profiles` VALUES ('4', 'Sales Department', '104', '2');
119 INSERT INTO `0_print_profiles` VALUES ('5', 'Sales Department', '105', '2');
120 INSERT INTO `0_print_profiles` VALUES ('6', 'Sales Department', '107', '2');
121 INSERT INTO `0_print_profiles` VALUES ('7', 'Sales Department', '109', '2');
122 INSERT INTO `0_print_profiles` VALUES ('8', 'Sales Department', '110', '2');
123 INSERT INTO `0_print_profiles` VALUES ('9', 'Sales Department', '201', '2');
124
125 DROP TABLE IF EXISTS `0_printers`;
126
127 CREATE TABLE `0_printers` (
128   `id` smallint(6) NOT NULL auto_increment,
129   `name` varchar(20) NOT NULL,
130   `description` varchar(60) NOT NULL,
131   `queue` varchar(20) NOT NULL,
132   `host` varchar(40) NOT NULL,
133   `port` smallint(11) unsigned NOT NULL,
134   `timeout` tinyint(3) unsigned NOT NULL,
135   PRIMARY KEY  (`id`),
136   UNIQUE KEY `name` (`name`)
137 ) TYPE=MyISAM AUTO_INCREMENT=4;
138
139 INSERT INTO `0_printers` VALUES ('1', 'QL500', 'Label printer', 'QL500', 'server', '127', '20');
140 INSERT INTO `0_printers` VALUES ('2', 'Samsung', 'Main network printer', 'scx4521F', 'server', '515', '5');
141 INSERT INTO `0_printers` VALUES ('3', 'Local', 'Local print server at user IP', 'lp', '', '515', '10');