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