View | Details | Raw Unified | Return to bug 10855
Collapse All | Expand All

(-)a/installer/data/mysql/kohastructure.sql (+30 lines)
Lines 3333-3338 ALTER TABLE `patron_list_patrons` Link Here
3333
  ADD CONSTRAINT patron_list_patrons_ibfk_1 FOREIGN KEY (patron_list_id) REFERENCES patron_lists (patron_list_id) ON DELETE CASCADE ON UPDATE CASCADE,
3333
  ADD CONSTRAINT patron_list_patrons_ibfk_1 FOREIGN KEY (patron_list_id) REFERENCES patron_lists (patron_list_id) ON DELETE CASCADE ON UPDATE CASCADE,
3334
  ADD CONSTRAINT patron_list_patrons_ibfk_2 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE;
3334
  ADD CONSTRAINT patron_list_patrons_ibfk_2 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE;
3335
3335
3336
--
3337
-- Table structure for table addition_fields
3338
-- This table add the ability to add new fields for a record
3339
--
3340
3341
CREATE TABLE `additional_fields` (
3342
  `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
3343
  `tablename` varchar(255) NOT NULL DEFAULT '', -- tablename of the new field
3344
  `name` varchar(255) NOT NULL DEFAULT '', -- name of the field
3345
  `authorised_value_category` varchar(16) NOT NULL DEFAULT '', -- is an authorised value category
3346
  `marcfield` varchar(16) NOT NULL DEFAULT '', -- contains the marc field to copied into the record
3347
  `searchable` tinyint(1) NOT NULL DEFAULT '0', -- is the field searchable?
3348
  PRIMARY KEY (`id`),
3349
  UNIQUE KEY `fields_uniq` (`tablename`,`name`)
3350
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3351
3352
--
3353
-- Table structure for table addition_field_values
3354
-- This table store values for additional fields
3355
--
3356
3357
CREATE TABLE `additional_field_values` (
3358
  `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
3359
  `field_id` int(11) NOT NULL, -- foreign key references addition_fields(id)
3360
  `record_id` int(11) NOT NULL, -- record_id
3361
  `value` varchar(255) NOT NULL DEFAULT '', -- value for this field
3362
  PRIMARY KEY (`id`),
3363
  UNIQUE KEY `field_record` (`field_id`,`record_id`),
3364
  CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
3365
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3336
3366
3337
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
3367
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
3338
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
3368
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
(-)a/installer/data/mysql/updatedatabase.pl (-2 / +38 lines)
Lines 7130-7136 if ( CheckVersion($DBversion) ) { Link Here
7130
    SetVersion($DBversion);
7130
    SetVersion($DBversion);
7131
}
7131
}
7132
7132
7133
7134
$DBversion = "3.13.00.020";
7133
$DBversion = "3.13.00.020";
7135
if ( CheckVersion($DBversion) ) {
7134
if ( CheckVersion($DBversion) ) {
7136
    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('WhenLostForgiveFine','0',NULL,'If ON, Forgives the fines on an item when it is lost.','YesNo')");
7135
    $dbh->do("INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES('WhenLostForgiveFine','0',NULL,'If ON, Forgives the fines on an item when it is lost.','YesNo')");
Lines 7636-7641 if ( CheckVersion($DBversion) ) { Link Here
7636
    SetVersion($DBversion);
7635
    SetVersion($DBversion);
7637
}
7636
}
7638
7637
7638
7639
7640
7641
7642
7643
7644
7645
7646
7647
$DBversion = "3.13.00.XXX";
7648
if ( CheckVersion($DBversion) ) {
7649
    $dbh->do(q|
7650
        CREATE TABLE `additional_fields` (
7651
          `id` int(11) NOT NULL AUTO_INCREMENT,
7652
          `tablename` varchar(255) NOT NULL DEFAULT '',
7653
          `name` varchar(255) NOT NULL DEFAULT '',
7654
          `authorised_value_category` varchar(16) NOT NULL DEFAULT '',
7655
          `marcfield` varchar(16) NOT NULL DEFAULT '',
7656
          `searchable` tinyint(1) NOT NULL DEFAULT '0',
7657
          PRIMARY KEY (`id`),
7658
          UNIQUE KEY `fields_uniq` (`tablename`,`name`)
7659
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8
7660
    |);
7661
    $dbh->do(q|
7662
        CREATE TABLE `additional_field_values` (
7663
          `id` int(11) NOT NULL AUTO_INCREMENT,
7664
          `field_id` int(11) NOT NULL,
7665
          `record_id` int(11) NOT NULL,
7666
          `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
7667
          PRIMARY KEY (`id`),
7668
          UNIQUE KEY `field_record` (`field_id`,`record_id`),
7669
          CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
7670
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8
7671
    |);
7672
    print "Upgrade to $DBversion done (Bug 10855: Add tables additional_fields and additional_field_values)\n";
7673
    SetVersion($DBversion);
7674
}
7675
7639
=head1 FUNCTIONS
7676
=head1 FUNCTIONS
7640
7677
7641
=head2 TableExists($table)
7678
=head2 TableExists($table)
7642
- 

Return to bug 10855