Table optimisation : aqorders. SPEEEEEEEEEEEEEEEDs up receive.pl. try to add indexes...
[koha.git] / database.mysql
1 # MySQL dump 7.1
2 #
3 # Host: localhost    Database: c4test
4 #--------------------------------------------------------
5 # Server version        3.22.32-log
6
7 #
8 # Table structure for table 'accountlines'
9 #
10 CREATE TABLE accountlines (
11   borrowernumber int(11) DEFAULT '0' NOT NULL,
12   accountno smallint(6) DEFAULT '0' NOT NULL,
13   itemnumber int(11),
14   date date,
15   amount decimal(28,6),
16   description text,
17   dispute text,
18   accounttype varchar(5),
19   amountoutstanding decimal(28,6),
20   timestamp timestamp(14),
21   KEY acctsborridx (borrowernumber),
22   KEY timeidx (timestamp)
23 );
24
25 #
26 # Table structure for table 'accountoffsets'
27 #
28 CREATE TABLE accountoffsets (
29   borrowernumber int(11) DEFAULT '0' NOT NULL,
30   accountno smallint(6) DEFAULT '0' NOT NULL,
31   offsetaccount smallint(6) DEFAULT '0' NOT NULL,
32   offsetamount decimal(28,6),
33   timestamp timestamp(14)
34 );
35
36 #
37 # Table structure for table 'additionalauthors'
38 #
39 CREATE TABLE additionalauthors (
40   author text NOT NULL,
41   biblionumber int(11) DEFAULT '0' NOT NULL,
42   KEY bibidx (biblionumber)
43 );
44
45 #
46 # Table structure for table 'aqbookfund'
47 #
48 CREATE TABLE aqbookfund (
49   bookfundid varchar(5) DEFAULT '' NOT NULL,
50   bookfundname text,
51   bookfundgroup varchar(5)
52 );
53
54 #
55 # Table structure for table 'aqbooksellers'
56 #
57 CREATE TABLE aqbooksellers (
58   id int(11),
59   name text,
60   address1 text,
61   address2 text,
62   address3 text,
63   address4 text,
64   phone varchar(30),
65   accountnumber text,
66   othersupplier text,
67   currency char(3) DEFAULT '' NOT NULL,
68   deliverydays smallint(6),
69   followupdays smallint(6),
70   followupscancel smallint(6),
71   specialty text,
72   booksellerfax text,
73   notes text,
74   bookselleremail text,
75   booksellerurl text,
76   contact varchar(100),
77   postal text,
78   url varchar(255),
79   contpos varchar(100),
80   contphone varchar(100),
81   contfax varchar(100),
82   contaltphone varchar(100),
83   contemail varchar(100),
84   contnotes text,
85   active tinyint(4),
86   listprice varchar(5),
87   invoiceprice varchar(5),
88   gstreg tinyint(4),
89   listincgst tinyint(4),
90   invoiceincgst tinyint(4),
91   discount float(6,4),
92   fax varchar(50)
93 );
94
95 #
96 # Table structure for table 'aqbudget'
97 #
98 CREATE TABLE aqbudget (
99   bookfundid char(5) DEFAULT '' NOT NULL,
100   startdate date DEFAULT '0000-00-00' NOT NULL,
101   enddate date,
102   budgetamount decimal(13,2)
103 );
104
105 #
106 # Table structure for table 'aqorderbreakdown'
107 #
108 CREATE TABLE aqorderbreakdown (
109   ordernumber int(11),
110   linenumber int(11),
111   branchcode char(4),
112   bookfundid char(5) DEFAULT '' NOT NULL,
113   allocation smallint(6)
114 );
115
116 #
117 # Table structure for table 'aqorderdelivery'
118 #
119 CREATE TABLE aqorderdelivery (
120   ordernumber date DEFAULT '0000-00-00' NOT NULL,
121   deliverynumber smallint(6) DEFAULT '0' NOT NULL,
122   deliverydate varchar(18),
123   qtydelivered smallint(6),
124   deliverycomments text
125 );
126
127 #
128 # Table structure for table 'aqorders'
129 #
130 CREATE TABLE aqorders (
131   ordernumber int(11) NOT NULL auto_increment,
132   biblionumber int(11) default NULL,
133   title text,
134   requisitionedby varchar(10) default NULL,
135   authorisedby varchar(10) default NULL,
136   booksellerid varchar(10) NOT NULL default '',
137   deliverydays smallint(6) default NULL,
138   followupdays smallint(6) default NULL,
139   numberfollowupsallowed smallint(6) default NULL,
140   numberfollowupssent smallint(6) default NULL,
141   entrydate date default NULL,
142   dateprinted date default NULL,
143   quantity smallint(6) default NULL,
144   currency char(3) default NULL,
145   listprice decimal(28,6) default NULL,
146   totalamount decimal(28,6) default NULL,
147   datereceived date default NULL,
148   booksellerinvoicenumber text,
149   freight decimal(28,6) default NULL,
150   unitprice decimal(28,6) default NULL,
151   quantityreceived smallint(6) default NULL,
152   sourced text,
153   cancelledby varchar(10) default NULL,
154   quantityreceiveddamaged smallint(6) default NULL,
155   datecancellationprinted date default NULL,
156   notes text,
157   supplierreference text,
158   purchaseordernumber text,
159   subscription tinyint(1) default NULL,
160   subscriptionfrom date default NULL,
161   subscriptionto date default NULL,
162   serialid varchar(30) default NULL,
163   basketno int(11) default NULL,
164   biblioitemnumber int(11) default NULL,
165   timestamp timestamp(14) NOT NULL,
166   rrp decimal(13,2) default NULL,
167   ecost decimal(13,2) default NULL,
168   gst decimal(13,2) default NULL,
169   PRIMARY KEY  (ordernumber),
170   KEY booksellerid (booksellerid),
171   KEY biblionumber (biblionumber),
172   KEY biblioitemnumber (biblioitemnumber),
173   KEY biblioitemnumber_2 (biblioitemnumber)
174 ) TYPE=MyISAM;
175
176 #
177 # Table structure for table 'biblio'
178 #
179 CREATE TABLE biblio (
180   biblionumber int(11) DEFAULT '0' NOT NULL,
181   author text,
182   title text,
183   unititle text,
184   notes text,
185   serial tinyint(1),
186   seriestitle text,
187   copyrightdate smallint(6),
188   timestamp timestamp(14),
189   KEY blbnoidx (biblionumber),
190   PRIMARY KEY (biblionumber)
191 );
192
193 #
194 # Table structure for table 'biblioanalysis'
195 #
196 CREATE TABLE biblioanalysis (
197   analyticaltitle text,
198   biblionumber int(11) DEFAULT '0' NOT NULL,
199   analyticalauthor text
200 );
201
202 #
203 # Table structure for table 'biblioitems'
204 #
205 CREATE TABLE biblioitems (
206   biblioitemnumber int(11) DEFAULT '0' NOT NULL,
207   biblionumber int(11) DEFAULT '0' NOT NULL,
208   volume text,
209   number text,
210   classification varchar(25),
211   itemtype varchar(4),
212   isbn varchar(14),
213   issn varchar(9),
214   dewey double(8,6),
215   subclass char(3),
216   publicationyear smallint(6),
217   publishercode varchar(255),
218   volumedate date,
219   volumeddesc varchar(255),
220   timestamp timestamp(14),
221   illus varchar(255),
222   pages varchar(255),
223   notes text,
224   size varchar(255),
225   place varchar(255),
226   KEY bibinoidx (biblioitemnumber),
227   KEY bibnoidx (biblionumber),
228   PRIMARY KEY (biblioitemnumber)
229 );
230
231 #
232 # Table structure for table 'bibliosubject'
233 #
234 CREATE TABLE bibliosubject (
235   subject text NOT NULL,
236   biblionumber int(11) DEFAULT '0' NOT NULL
237 );
238
239 #
240 # Table structure for table 'bibliosubtitle'
241 #
242 CREATE TABLE bibliosubtitle (
243   subtitle text NOT NULL,
244   biblionumber int(11) DEFAULT '0' NOT NULL,
245   KEY bibsubidx (biblionumber)
246 );
247
248 #
249 # Table structure for table 'borexp'
250 #
251 CREATE TABLE borexp (
252   borrowernumber int(11),
253   newexp date
254 );
255
256 #
257 # Table structure for table 'borrowers'
258 #
259 CREATE TABLE borrowers (
260   borrowernumber int(11) DEFAULT '0' NOT NULL,
261   cardnumber varchar(9) DEFAULT '' NOT NULL,
262   surname text NOT NULL,
263   firstname text NOT NULL,
264   title text,
265   othernames text,
266   initials text NOT NULL,
267   streetaddress text NOT NULL,
268   suburb text,
269   city text NOT NULL,
270   phone text NOT NULL,
271   emailaddress text,
272   faxnumber text,
273   altstreetaddress text,
274   altsuburb text,
275   altcity text,
276   altphone text,
277   dateofbirth date,
278   branchcode varchar(4) DEFAULT '' NOT NULL,
279   categorycode char(2),
280   dateenrolled date,
281   gonenoaddress tinyint(1),
282   lost tinyint(1),
283   debarred tinyint(1),
284   studentnumber text,
285   school text,
286   contactname text,
287   borrowernotes text,
288   guarantor int(11),
289   area char(2),
290   ethnicity varchar(50),
291   ethnotes varchar(255),
292   sex char(1),
293   expiry date,
294   altnotes varchar(255),
295   altrelationship varchar(100),
296   streetcity text,
297   phoneday varchar(50),
298   preferredcont char(1),
299   physstreet varchar(100),
300   KEY borrowernumber (borrowernumber),
301   KEY cardnumber (cardnumber)
302 );
303
304 #
305 # Table structure for table 'branchcategories'
306 #
307 CREATE TABLE branchcategories (
308   categorycode char(2) DEFAULT '' NOT NULL,
309   branchcode char(4) DEFAULT '' NOT NULL,
310   branchholding int(11)
311 );
312
313 #
314 # Table structure for table 'branches'
315 #
316 CREATE TABLE branches (
317   branchcode varchar(4) DEFAULT '' NOT NULL,
318   branchname text NOT NULL,
319   branchaddress1 text,
320   branchaddress2 text,
321   branchaddress3 text,
322   branchphone text,
323   branchfax text,
324   branchemail text,
325   issuing tinyint(4),
326   UNIQUE branchcode (branchcode)
327 );
328
329 #
330 # Table structure for table 'branchtransfers'
331 #
332 CREATE TABLE branchtransfers (
333   itemnumber int(11) DEFAULT '0' NOT NULL,
334   datesent date DEFAULT '0000-00-00' NOT NULL,
335   frombranch varchar(4),
336   datearrived date,
337   tobranch varchar(4),
338   comments text
339 );
340
341 #
342 # Table structure for table 'catalogueentry'
343 #
344 CREATE TABLE catalogueentry (
345   catalogueentry text NOT NULL,
346   entrytype char(2),
347   see text,
348   seealso text,
349   seeinstead text,
350   biblionumber int(11)
351 );
352
353 #
354 # Table structure for table 'categories'
355 #
356 CREATE TABLE categories (
357   categorycode char(2) DEFAULT '' NOT NULL,
358   description text,
359   enrolmentperiod smallint(6),
360   upperagelimit smallint(6),
361   dateofbirthrequired tinyint(1),
362   finetype varchar(30),
363   bulk tinyint(1),
364   enrolmentfee decimal(28,6),
365   overduenoticerequired tinyint(1),
366   issuelimit smallint(6),
367   reservefee decimal(28,6),
368   UNIQUE categorycode (categorycode)
369 );
370
371 #
372 # Table structure for table 'categoryitem'
373 #
374 CREATE TABLE categoryitem (
375   categorycode char(2) DEFAULT '' NOT NULL,
376   itemtype varchar(4) DEFAULT '' NOT NULL,
377   restrictedtype tinyint(1),
378   rentaldiscount decimal(28,6),
379   reservecharge decimal(28,6),
380   fine decimal(28,6),
381   firstremind int(11),
382   chargeperiod int(11),
383   accountsent int(11),
384   chargename varchar(100)
385 );
386
387 #
388 # Table structure for table 'classification'
389 #
390 CREATE TABLE classification (
391   classification varchar(12) DEFAULT '' NOT NULL
392 );
393
394 #
395 # Table structure for table 'currency'
396 #
397 CREATE TABLE currency (
398   currency varchar(10),
399   rate float(7,5)
400 );
401
402 #
403 # Table structure for table 'deletedbiblio'
404 #
405 CREATE TABLE deletedbiblio (
406   biblionumber int(11) DEFAULT '0' NOT NULL,
407   author text,
408   title text,
409   unititle text,
410   notes text,
411   serial tinyint(1),
412   seriestitle text,
413   copyrightdate smallint(6),
414   timestamp timestamp(14),
415   KEY blbnoidx (biblionumber),
416   PRIMARY KEY (biblionumber)
417 );
418
419 #
420 # Table structure for table 'deletedbiblioitems'
421 #
422 CREATE TABLE deletedbiblioitems (
423   biblioitemnumber int(11) DEFAULT '0' NOT NULL,
424   biblionumber int(11) DEFAULT '0' NOT NULL,
425   volume text,
426   number text,
427   classification varchar(25),
428   itemtype varchar(4),
429   isbn varchar(14),
430   issn varchar(9),
431   dewey double(8,6),
432   subclass char(3),
433   publicationyear smallint(6),
434   publishercode varchar(255),
435   volumedate date,
436   volumeddesc varchar(255),
437   timestamp timestamp(14),
438   illus varchar(255),
439   pages varchar(255),
440   notes text,
441   size varchar(255),
442   KEY bibinoidx (biblioitemnumber),
443   KEY bibnoidx (biblionumber),
444   PRIMARY KEY (biblioitemnumber)
445 );
446
447 #
448 # Table structure for table 'deletedborrowers'
449 #
450 CREATE TABLE deletedborrowers (
451   borrowernumber int(11) DEFAULT '0' NOT NULL,
452   cardnumber varchar(9) DEFAULT '' NOT NULL,
453   surname text NOT NULL,
454   firstname text NOT NULL,
455   title text,
456   othernames text,
457   initials text NOT NULL,
458   streetaddress text NOT NULL,
459   suburb text,
460   city text NOT NULL,
461   phone text NOT NULL,
462   emailaddress text,
463   faxnumber text,
464   altstreetaddress text,
465   altsuburb text,
466   altcity text,
467   altphone text,
468   dateofbirth date,
469   branchcode varchar(4) DEFAULT '' NOT NULL,
470   categorycode char(2),
471   dateenrolled date,
472   gonenoaddress tinyint(1),
473   lost tinyint(1),
474   debarred tinyint(1),
475   studentnumber text,
476   school text,
477   contactname text,
478   borrowernotes text,
479   guarantor int(11),
480   area char(2),
481   ethnicity varchar(50),
482   ethnotes varchar(255),
483   sex char(1),
484   expiry date,
485   altnotes varchar(255),
486   altrelationship varchar(100),
487   streetcity text,
488   phoneday varchar(50),
489   preferredcont varchar(100),
490   physstreet varchar(100),
491   KEY borrowernumber (borrowernumber),
492   KEY cardnumber (cardnumber)
493 );
494
495 #
496 # Table structure for table 'deleteditems'
497 #
498 CREATE TABLE deleteditems (
499   itemnumber int(11) DEFAULT '0' NOT NULL,
500   biblionumber int(11) DEFAULT '0' NOT NULL,
501   multivolumepart varchar(30),
502   biblioitemnumber int(11) DEFAULT '0' NOT NULL,
503   barcode varchar(9) DEFAULT '' NOT NULL,
504   dateaccessioned date,
505   booksellerid varchar(10),
506   homebranch varchar(4),
507   price decimal(28,6),
508   replacementprice decimal(28,6),
509   replacementpricedate date,
510   datelastborrowed date,
511   datelastseen date,
512   multivolume tinyint(1),
513   stack tinyint(1),
514   notforloan tinyint(1),
515   itemlost tinyint(1),
516   wthdrawn tinyint(1),
517   bulk varchar(30),
518   issues smallint(6),
519   renewals smallint(6),
520   reserves smallint(6),
521   restricted tinyint(1),
522   binding decimal(28,6),
523   itemnotes text,
524   holdingbranch varchar(4),
525   interim tinyint(1),
526   timestamp timestamp(14),
527   KEY itembarcodeidx (barcode),
528   KEY itembinoidx (biblioitemnumber),
529   KEY itembibnoidx (biblionumber),
530   PRIMARY KEY (itemnumber),
531   UNIQUE barcode (barcode)
532 );
533
534 #
535 # Table structure for table 'issues'
536 #
537 CREATE TABLE issues (
538   borrowernumber int(11) DEFAULT '0' NOT NULL,
539   itemnumber int(11) DEFAULT '0' NOT NULL,
540   date_due date,
541   branchcode char(4),
542   issuingbranch char(18),
543   returndate date,
544   lastreneweddate date,
545   return char(4),
546   renewals tinyint(4),
547   timestamp timestamp(14),
548   KEY issuesborridx (borrowernumber),
549   KEY issuesitemidx (itemnumber),
550   KEY bordate (borrowernumber,timestamp)
551 );
552
553 #
554 # Table structure for table 'items'
555 #
556 CREATE TABLE items (
557   itemnumber int(11) DEFAULT '0' NOT NULL,
558   biblionumber int(11) DEFAULT '0' NOT NULL,
559   multivolumepart varchar(30),
560   biblioitemnumber int(11) DEFAULT '0' NOT NULL,
561   barcode varchar(9) DEFAULT '' NOT NULL,
562   dateaccessioned date,
563   booksellerid varchar(10),
564   homebranch varchar(4),
565   price decimal(8,2),
566   replacementprice decimal(8,2),
567   replacementpricedate date,
568   datelastborrowed date,
569   datelastseen date,
570   multivolume tinyint(1),
571   stack tinyint(1),
572   notforloan tinyint(1),
573   itemlost tinyint(1),
574   wthdrawn tinyint(1),
575   bulk varchar(30),
576   issues smallint(6),
577   renewals smallint(6),
578   reserves smallint(6),
579   restricted tinyint(1),
580   binding decimal(28,6),
581   itemnotes text,
582   holdingbranch varchar(4),
583   paidfor text,
584   timestamp timestamp(14),
585   KEY itembarcodeidx (barcode),
586   KEY itembinoidx (biblioitemnumber),
587   KEY itembibnoidx (biblionumber),
588   PRIMARY KEY (itemnumber),
589   UNIQUE barcode (barcode)
590 );
591
592 #
593 # Table structure for table 'itemsprices'
594 #
595 CREATE TABLE itemsprices (
596   itemnumber int(11),
597   price1 decimal(28,6),
598   price2 decimal(28,6)
599 );
600
601 #
602 # Table structure for table 'itemtypes'
603 #
604 CREATE TABLE itemtypes (
605   itemtype varchar(4) DEFAULT '' NOT NULL,
606   description text,
607   loanlength smallint(6),
608   renewalsallowed smallint(6),
609   rentalcharge double(16,4),
610   UNIQUE itemtype (itemtype)
611 );
612
613 #
614 # Table structure for table 'multipart'
615 #
616 CREATE TABLE multipart (
617   itemnumber int(11) DEFAULT '0' NOT NULL,
618   other int(11) DEFAULT '0' NOT NULL
619 );
620
621 #
622 # Table structure for table 'multivolume'
623 #
624 CREATE TABLE multivolume (
625   biblionumber int(11) DEFAULT '0' NOT NULL,
626   multivolumepart varchar(30) DEFAULT '' NOT NULL
627 );
628
629 #
630 # Table structure for table 'newitems'
631 #
632 CREATE TABLE newitems (
633   itemnumber int(11) DEFAULT '0' NOT NULL,
634   publishercode varchar(18),
635   biblionumber int(11) DEFAULT '0' NOT NULL,
636   multivolumepart varchar(30),
637   barcode varchar(9) DEFAULT '' NOT NULL,
638   dateaccessioned date,
639   booksellerid varchar(10),
640   homebranch varchar(4),
641   price decimal(28,6),
642   replacementprice decimal(28,6),
643   replacementpricedate date,
644   datelastborrowed date,
645   datelastseen date,
646   multivolume tinyint(1),
647   stack tinyint(1),
648   notforloan tinyint(1),
649   itemlost tinyint(1),
650   wthdrawn tinyint(1),
651   bulk varchar(30),
652   issues smallint(6),
653   renewals smallint(6),
654   reserves smallint(6),
655   restricted tinyint(1),
656   binding decimal(28,6),
657   itemnotes text,
658   holdingbranch varchar(4),
659   interim tinyint(1),
660   volume text,
661   number text,
662   classification varchar(12),
663   itemtype varchar(4),
664   isbn varchar(14),
665   issn varchar(9),
666   dewey double(16,4),
667   subclass char(3),
668   publicationyear smallint(6),
669   KEY itembarcodeidx (barcode),
670   KEY itembibnoidx (biblionumber),
671   PRIMARY KEY (itemnumber)
672 );
673
674 #
675 # Table structure for table 'printers'
676 #
677 CREATE TABLE printers (
678   printername char(40),
679   printqueue char(20),
680   printtype char(20)
681 );
682
683 #
684 # Table structure for table 'procedures'
685 #
686 CREATE TABLE procedures (
687   proccode varchar(4),
688   procdesc text,
689   proclevel smallint(6)
690 );
691
692 #
693 # Table structure for table 'publisher'
694 #
695 CREATE TABLE publisher (
696   publishercode varchar(18) DEFAULT '' NOT NULL,
697   publishername text NOT NULL
698 );
699
700 #
701 # Table structure for table 'reserveconstraints'
702 #
703 CREATE TABLE reserveconstraints (
704   borrowernumber int(11) DEFAULT '0' NOT NULL,
705   reservedate date DEFAULT '0000-00-00' NOT NULL,
706   biblionumber int(11) DEFAULT '0' NOT NULL,
707   biblioitemnumber int(11),
708   timestamp timestamp(14)
709 );
710
711 #
712 # Table structure for table 'reserves'
713 #
714 CREATE TABLE reserves (
715   borrowernumber int(11) DEFAULT '0' NOT NULL,
716   reservedate date DEFAULT '0000-00-00' NOT NULL,
717   biblionumber int(11) DEFAULT '0' NOT NULL,
718   constrainttype char(1),
719   branchcode varchar(4),
720   notificationdate date,
721   reminderdate date,
722   cancellationdate date,
723   reservenotes text,
724   priority smallint(6),
725   found char(1),
726   timestamp timestamp(14),
727   itemnumber int(11)
728 );
729
730 #
731 # Table structure for table 'searchstats'
732 #
733 CREATE TABLE searchstats (
734   time datetime,
735   searchstring text
736 );
737
738 #
739 # Table structure for table 'serialissues'
740 #
741 CREATE TABLE serialissues (
742   biblionumber int(11) DEFAULT '0' NOT NULL,
743   volume varchar(20) DEFAULT '' NOT NULL,
744   number varchar(20) DEFAULT '' NOT NULL,
745   ordernumber smallint(6),
746   issuedate varchar(20),
747   received varchar(18)
748 );
749
750 #
751 # Table structure for table 'statistics'
752 #
753 CREATE TABLE statistics (
754   datetime datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
755   branch varchar(4),
756   proccode varchar(4),
757   value double(16,4),
758   type varchar(16),
759   other text,
760   usercode varchar(10),
761   itemnumber int(11),
762   itemtype varchar(4),
763   KEY timeidx (datetime)
764 );
765
766 #
767 # Table structure for table 'stopwords'
768 #
769 CREATE TABLE stopwords (
770   word varchar(255)
771 );
772
773 #
774 # Table structure for table 'systempreferences'
775 #
776 CREATE TABLE systempreferences (
777   variable char(50) DEFAULT '' NOT NULL,
778   value char(200),
779   PRIMARY KEY (variable)
780 );
781
782 #
783 # Table structure for table 'users'
784 #
785 CREATE TABLE users (
786   usercode varchar(10),
787   username text,
788   password text,
789   level smallint(6)
790 );
791