Third in the series of branch merges. Starting to run out of easy stuff. :)
[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   abstract text,
186   serial tinyint(1),
187   seriestitle text,
188   copyrightdate smallint(6),
189   timestamp timestamp(14),
190   KEY blbnoidx (biblionumber),
191   PRIMARY KEY (biblionumber)
192 );
193
194 #
195 # Table structure for table 'biblioanalysis'
196 #
197 CREATE TABLE biblioanalysis (
198   analyticaltitle text,
199   biblionumber int(11) DEFAULT '0' NOT NULL,
200   analyticalauthor text
201 );
202
203 #
204 # Table structure for table 'biblioitems'
205 #
206 CREATE TABLE biblioitems (
207   biblioitemnumber int(11) DEFAULT '0' NOT NULL,
208   biblionumber int(11) DEFAULT '0' NOT NULL,
209   volume text,
210   number text,
211   classification varchar(25),
212   itemtype varchar(4),
213   url varchar(255),
214   isbn varchar(14),
215   issn varchar(9),
216   dewey double(8,6),
217   subclass char(3),
218   publicationyear smallint(6),
219   publishercode varchar(255),
220   volumedate date,
221   volumeddesc varchar(255),
222   timestamp timestamp(14),
223   illus varchar(255),
224   pages varchar(255),
225   notes text,
226   size varchar(255),
227   place varchar(255),
228   KEY bibinoidx (biblioitemnumber),
229   KEY bibnoidx (biblionumber),
230   PRIMARY KEY (biblioitemnumber)
231 );
232
233 #
234 # Table structure for table 'bibliosubject'
235 #
236 CREATE TABLE bibliosubject (
237   subject text NOT NULL,
238   biblionumber int(11) DEFAULT '0' NOT NULL
239 );
240
241 #
242 # Table structure for table 'bibliosubtitle'
243 #
244 CREATE TABLE bibliosubtitle (
245   subtitle text NOT NULL,
246   biblionumber int(11) DEFAULT '0' NOT NULL,
247   KEY bibsubidx (biblionumber)
248 );
249
250 #
251 # Table structure for table 'borexp'
252 #
253 CREATE TABLE borexp (
254   borrowernumber int(11),
255   newexp date
256 );
257
258 #
259 # Table structure for table 'borrowers'
260 #
261 CREATE TABLE borrowers (
262   borrowernumber int(11) DEFAULT '0' NOT NULL,
263   cardnumber varchar(9) DEFAULT '' NOT NULL,
264   surname text NOT NULL,
265   firstname text NOT NULL,
266   title text,
267   othernames text,
268   initials text NOT NULL,
269   streetaddress text NOT NULL,
270   suburb text,
271   city text NOT NULL,
272   phone text NOT NULL,
273   emailaddress text,
274   faxnumber text,
275   altstreetaddress text,
276   altsuburb text,
277   altcity text,
278   altphone text,
279   dateofbirth date,
280   branchcode varchar(4) DEFAULT '' NOT NULL,
281   categorycode char(2),
282   dateenrolled date,
283   gonenoaddress tinyint(1),
284   lost tinyint(1),
285   debarred tinyint(1),
286   studentnumber text,
287   school text,
288   contactname text,
289   borrowernotes text,
290   guarantor int(11),
291   area char(2),
292   ethnicity varchar(50),
293   ethnotes varchar(255),
294   sex char(1),
295   expiry date,
296   altnotes varchar(255),
297   altrelationship varchar(100),
298   streetcity text,
299   phoneday varchar(50),
300   preferredcont char(1),
301   physstreet varchar(100),
302   KEY borrowernumber (borrowernumber),
303   KEY cardnumber (cardnumber)
304 );
305
306 #
307 # Table structure for table 'branchcategories'
308 #
309 CREATE TABLE branchcategories (
310   categorycode char(2) DEFAULT '' NOT NULL,
311   categoryname text,
312   codedescription text,    
313   PRIMARY KEY (categorycode)   
314 );      
315
316 # Table structure for table 'branchrelations'   
317 #
318 CREATE TABLE branchrelations (
319   branchcode varchar(4) DEFAULT '' NOT NULL,
320   categorycode varchar(4) DEFAULT '' NOT NULL  
321 );
322
323 #
324 # Table structure for table 'branches'
325 #
326 CREATE TABLE branches (
327   branchcode varchar(4) DEFAULT '' NOT NULL,
328   branchname text NOT NULL,
329   branchaddress1 text,
330   branchaddress2 text,
331   branchaddress3 text,
332   branchphone text,
333   branchfax text,
334   branchemail text,
335   issuing tinyint(4),
336   UNIQUE branchcode (branchcode)
337 );
338
339 #
340 # Table structure for table 'branchtransfers'
341 #
342 CREATE TABLE branchtransfers (
343   itemnumber int(11) DEFAULT '0' NOT NULL,
344   datesent datetime DEFAULT '0000-00-00' NOT NULL,
345   frombranch varchar(4),
346   datearrived datetime,
347   tobranch varchar(4),
348   comments text
349 );
350
351 #
352 # Table structure for table 'catalogueentry'
353 #
354 CREATE TABLE catalogueentry (
355   catalogueentry text NOT NULL,
356   entrytype char(2),
357   see text,
358   seealso text,
359   seeinstead text,
360   biblionumber int(11)
361 );
362
363 #
364 # Table structure for table 'categories'
365 #
366 CREATE TABLE categories (
367   categorycode char(2) DEFAULT '' NOT NULL,
368   description text,
369   enrolmentperiod smallint(6),
370   upperagelimit smallint(6),
371   dateofbirthrequired tinyint(1),
372   finetype varchar(30),
373   bulk tinyint(1),
374   enrolmentfee decimal(28,6),
375   overduenoticerequired tinyint(1),
376   issuelimit smallint(6),
377   reservefee decimal(28,6),
378   UNIQUE categorycode (categorycode)
379 );
380
381 #
382 # Table structure for table 'categoryitem'
383 #
384 CREATE TABLE categoryitem (
385   categorycode char(2) DEFAULT '' NOT NULL,
386   itemtype varchar(4) DEFAULT '' NOT NULL,
387   restrictedtype tinyint(1),
388   rentaldiscount decimal(28,6),
389   reservecharge decimal(28,6),
390   fine decimal(28,6),
391   firstremind int(11),
392   chargeperiod int(11),
393   accountsent int(11),
394   chargename varchar(100)
395 );
396
397 #
398 # Table structure for table 'classification'
399 #
400 CREATE TABLE classification (
401   classification varchar(12) DEFAULT '' NOT NULL
402 );
403
404 #
405 # Table structure for table 'currency'
406 #
407 CREATE TABLE currency (
408   currency varchar(10),
409   rate float(7,5)
410 );
411
412 #
413 # Table structure for table 'deletedbiblio'
414 #
415 CREATE TABLE deletedbiblio (
416   biblionumber int(11) DEFAULT '0' NOT NULL,
417   author text,
418   title text,
419   unititle text,
420   notes text,
421   serial tinyint(1),
422   seriestitle text,
423   copyrightdate smallint(6),
424   timestamp timestamp(14),
425   KEY blbnoidx (biblionumber),
426   PRIMARY KEY (biblionumber)
427 );
428
429 #
430 # Table structure for table 'deletedbiblioitems'
431 #
432 CREATE TABLE deletedbiblioitems (
433   biblioitemnumber int(11) DEFAULT '0' NOT NULL,
434   biblionumber int(11) DEFAULT '0' NOT NULL,
435   volume text,
436   number text,
437   classification varchar(25),
438   itemtype varchar(4),
439   isbn varchar(14),
440   issn varchar(9),
441   dewey double(8,6),
442   subclass char(3),
443   publicationyear smallint(6),
444   publishercode varchar(255),
445   volumedate date,
446   volumeddesc varchar(255),
447   timestamp timestamp(14),
448   illus varchar(255),
449   pages varchar(255),
450   notes text,
451   size varchar(255),
452   KEY bibinoidx (biblioitemnumber),
453   KEY bibnoidx (biblionumber),
454   PRIMARY KEY (biblioitemnumber)
455 );
456
457 #
458 # Table structure for table 'deletedborrowers'
459 #
460 CREATE TABLE deletedborrowers (
461   borrowernumber int(11) DEFAULT '0' NOT NULL,
462   cardnumber varchar(9) DEFAULT '' NOT NULL,
463   surname text NOT NULL,
464   firstname text NOT NULL,
465   title text,
466   othernames text,
467   initials text NOT NULL,
468   streetaddress text NOT NULL,
469   suburb text,
470   city text NOT NULL,
471   phone text NOT NULL,
472   emailaddress text,
473   faxnumber text,
474   altstreetaddress text,
475   altsuburb text,
476   altcity text,
477   altphone text,
478   dateofbirth date,
479   branchcode varchar(4) DEFAULT '' NOT NULL,
480   categorycode char(2),
481   dateenrolled date,
482   gonenoaddress tinyint(1),
483   lost tinyint(1),
484   debarred tinyint(1),
485   studentnumber text,
486   school text,
487   contactname text,
488   borrowernotes text,
489   guarantor int(11),
490   area char(2),
491   ethnicity varchar(50),
492   ethnotes varchar(255),
493   sex char(1),
494   expiry date,
495   altnotes varchar(255),
496   altrelationship varchar(100),
497   streetcity text,
498   phoneday varchar(50),
499   preferredcont varchar(100),
500   physstreet varchar(100),
501   KEY borrowernumber (borrowernumber),
502   KEY cardnumber (cardnumber)
503 );
504
505 #
506 # Table structure for table 'deleteditems'
507 #
508 CREATE TABLE deleteditems (
509   itemnumber int(11) DEFAULT '0' NOT NULL,
510   biblionumber int(11) DEFAULT '0' NOT NULL,
511   multivolumepart varchar(30),
512   biblioitemnumber int(11) DEFAULT '0' NOT NULL,
513   barcode varchar(9) DEFAULT '' NOT NULL,
514   dateaccessioned date,
515   booksellerid varchar(10),
516   homebranch varchar(4),
517   price decimal(28,6),
518   replacementprice decimal(28,6),
519   replacementpricedate date,
520   datelastborrowed date,
521   datelastseen date,
522   multivolume tinyint(1),
523   stack tinyint(1),
524   notforloan tinyint(1),
525   itemlost tinyint(1),
526   wthdrawn tinyint(1),
527   bulk varchar(30),
528   issues smallint(6),
529   renewals smallint(6),
530   reserves smallint(6),
531   restricted tinyint(1),
532   binding decimal(28,6),
533   itemnotes text,
534   holdingbranch varchar(4),
535   interim tinyint(1),
536   timestamp timestamp(14),
537   KEY itembarcodeidx (barcode),
538   KEY itembinoidx (biblioitemnumber),
539   KEY itembibnoidx (biblionumber),
540   PRIMARY KEY (itemnumber),
541   UNIQUE barcode (barcode)
542 );
543
544 #
545 # Table structure for table 'issues'
546 #
547 CREATE TABLE issues (
548   borrowernumber int(11) DEFAULT '0' NOT NULL,
549   itemnumber int(11) DEFAULT '0' NOT NULL,
550   date_due date,
551   branchcode char(4),
552   issuingbranch char(18),
553   returndate date,
554   lastreneweddate date,
555   return char(4),
556   renewals tinyint(4),
557   timestamp timestamp(14),
558   KEY issuesborridx (borrowernumber),
559   KEY issuesitemidx (itemnumber),
560   KEY bordate (borrowernumber,timestamp)
561 );
562
563 #
564 # Table structure for table 'items'
565 #
566 CREATE TABLE items (
567   itemnumber int(11) DEFAULT '0' NOT NULL,
568   biblionumber int(11) DEFAULT '0' NOT NULL,
569   multivolumepart varchar(30),
570   biblioitemnumber int(11) DEFAULT '0' NOT NULL,
571   barcode varchar(9) DEFAULT '' NOT NULL,
572   dateaccessioned date,
573   booksellerid varchar(10),
574   homebranch varchar(4),
575   price decimal(8,2),
576   replacementprice decimal(8,2),
577   replacementpricedate date,
578   datelastborrowed date,
579   datelastseen date,
580   multivolume tinyint(1),
581   stack tinyint(1),
582   notforloan tinyint(1),
583   itemlost tinyint(1),
584   wthdrawn tinyint(1),
585   bulk varchar(30),
586   issues smallint(6),
587   renewals smallint(6),
588   reserves smallint(6),
589   restricted tinyint(1),
590   binding decimal(28,6),
591   itemnotes text,
592   holdingbranch varchar(4),
593   paidfor text,
594   timestamp timestamp(14),
595   KEY itembarcodeidx (barcode),
596   KEY itembinoidx (biblioitemnumber),
597   KEY itembibnoidx (biblionumber),
598   PRIMARY KEY (itemnumber),
599   UNIQUE barcode (barcode)
600 );
601
602 #
603 # Table structure for table 'itemsprices'
604 #
605 CREATE TABLE itemsprices (
606   itemnumber int(11),
607   price1 decimal(28,6),
608   price2 decimal(28,6)
609 );
610
611 #
612 # Table structure for table 'itemtypes'
613 #
614 CREATE TABLE itemtypes (
615   itemtype varchar(4) DEFAULT '' NOT NULL,
616   description text,
617   loanlength smallint(6),
618   renewalsallowed smallint(6),
619   rentalcharge double(16,4),
620   UNIQUE itemtype (itemtype)
621 );
622
623 #
624 # Table structure for table 'multipart'
625 #
626 CREATE TABLE multipart (
627   itemnumber int(11) DEFAULT '0' NOT NULL,
628   other int(11) DEFAULT '0' NOT NULL
629 );
630
631 #
632 # Table structure for table 'multivolume'
633 #
634 CREATE TABLE multivolume (
635   biblionumber int(11) DEFAULT '0' NOT NULL,
636   multivolumepart varchar(30) DEFAULT '' NOT NULL
637 );
638
639 #
640 # Table structure for table 'newitems'
641 #
642 CREATE TABLE newitems (
643   itemnumber int(11) DEFAULT '0' NOT NULL,
644   publishercode varchar(18),
645   biblionumber int(11) DEFAULT '0' NOT NULL,
646   multivolumepart varchar(30),
647   barcode varchar(9) DEFAULT '' NOT NULL,
648   dateaccessioned date,
649   booksellerid varchar(10),
650   homebranch varchar(4),
651   price decimal(28,6),
652   replacementprice decimal(28,6),
653   replacementpricedate date,
654   datelastborrowed date,
655   datelastseen date,
656   multivolume tinyint(1),
657   stack tinyint(1),
658   notforloan tinyint(1),
659   itemlost tinyint(1),
660   wthdrawn tinyint(1),
661   bulk varchar(30),
662   issues smallint(6),
663   renewals smallint(6),
664   reserves smallint(6),
665   restricted tinyint(1),
666   binding decimal(28,6),
667   itemnotes text,
668   holdingbranch varchar(4),
669   interim tinyint(1),
670   volume text,
671   number text,
672   classification varchar(12),
673   itemtype varchar(4),
674   isbn varchar(14),
675   issn varchar(9),
676   dewey double(16,4),
677   subclass char(3),
678   publicationyear smallint(6),
679   KEY itembarcodeidx (barcode),
680   KEY itembibnoidx (biblionumber),
681   PRIMARY KEY (itemnumber)
682 );
683
684 #
685 # Table structure for table 'printers'
686 #
687 CREATE TABLE printers (
688   printername char(40),
689   printqueue char(20),
690   printtype char(20)
691 );
692
693 #
694 # Table structure for table 'procedures'
695 #
696 CREATE TABLE procedures (
697   proccode varchar(4),
698   procdesc text,
699   proclevel smallint(6)
700 );
701
702 #
703 # Table structure for table 'publisher'
704 #
705 CREATE TABLE publisher (
706   publishercode varchar(18) DEFAULT '' NOT NULL,
707   publishername text NOT NULL
708 );
709
710 #
711 # Table structure for table 'reserveconstraints'
712 #
713 CREATE TABLE reserveconstraints (
714   borrowernumber int(11) DEFAULT '0' NOT NULL,
715   reservedate date DEFAULT '0000-00-00' NOT NULL,
716   biblionumber int(11) DEFAULT '0' NOT NULL,
717   biblioitemnumber int(11),
718   timestamp timestamp(14)
719 );
720
721 #
722 # Table structure for table 'reserves'
723 #
724 CREATE TABLE reserves (
725   borrowernumber int(11) DEFAULT '0' NOT NULL,
726   reservedate date DEFAULT '0000-00-00' NOT NULL,
727   biblionumber int(11) DEFAULT '0' NOT NULL,
728   constrainttype char(1),
729   branchcode varchar(4),
730   notificationdate date,
731   reminderdate date,
732   cancellationdate date,
733   reservenotes text,
734   priority smallint(6),
735   found char(1),
736   timestamp timestamp(14),
737   itemnumber int(11)
738 );
739
740 #
741 # Table structure for table 'searchstats'
742 #
743 CREATE TABLE searchstats (
744   time datetime,
745   searchstring text
746 );
747
748 #
749 # Table structure for table 'serialissues'
750 #
751 CREATE TABLE serialissues (
752   biblionumber int(11) DEFAULT '0' NOT NULL,
753   volume varchar(20) DEFAULT '' NOT NULL,
754   number varchar(20) DEFAULT '' NOT NULL,
755   ordernumber smallint(6),
756   issuedate varchar(20),
757   received varchar(18)
758 );
759
760 #
761 # Table structure for table 'statistics'
762 #
763 CREATE TABLE statistics (
764   datetime datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,
765   branch varchar(4),
766   proccode varchar(4),
767   value double(16,4),
768   type varchar(16),
769   other text,
770   usercode varchar(10),
771   itemnumber int(11),
772   itemtype varchar(4),
773   KEY timeidx (datetime)
774 );
775
776 #
777 # Table structure for table 'stopwords'
778 #
779 CREATE TABLE stopwords (
780   word varchar(255)
781 );
782
783 #
784 # Table structure for table 'systempreferences'
785 #
786 CREATE TABLE systempreferences (
787   variable char(50) DEFAULT '' NOT NULL,
788   value char(200),
789   PRIMARY KEY (variable)
790 );
791
792 #
793 # Table structure for table 'users'
794 #
795 CREATE TABLE users (
796   usercode varchar(10),
797   username text,
798   password text,
799   level smallint(6)
800 );
801
802 #
803 # Table structure for table 'websites'
804 #
805
806 CREATE TABLE websites (
807   websitenumber int(11) NOT NULL auto_increment,
808   biblionumber int(11) NOT NULL default '0',
809   title text,
810   description text,
811   url varchar(255),
812   PRIMARY KEY (websitenumber)
813 ) TYPE=ISAM PACK_KEYS=1;