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