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

(-)a/installer/data/mysql/kohastructure.sql (+31 lines)
Lines 3393-3398 CREATE TABLE IF NOT EXISTS marc_modification_template_actions ( Link Here
3393
  CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
3393
  CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
3394
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
3394
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
3395
3395
3396
--
3397
-- Table structure for table additional_fields
3398
-- This table add the ability to add new fields for a record
3399
--
3400
3401
CREATE TABLE `additional_fields` (
3402
  `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
3403
  `tablename` varchar(255) NOT NULL DEFAULT '', -- tablename of the new field
3404
  `name` varchar(255) NOT NULL DEFAULT '', -- name of the field
3405
  `authorised_value_category` varchar(16) NOT NULL DEFAULT '', -- is an authorised value category
3406
  `marcfield` varchar(16) NOT NULL DEFAULT '', -- contains the marc field to copied into the record
3407
  `searchable` tinyint(1) NOT NULL DEFAULT '0', -- is the field searchable?
3408
  PRIMARY KEY (`id`),
3409
  UNIQUE KEY `fields_uniq` (`tablename`,`name`)
3410
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3411
3412
--
3413
-- Table structure for table additional_field_values
3414
-- This table store values for additional fields
3415
--
3416
3417
CREATE TABLE `additional_field_values` (
3418
  `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
3419
  `field_id` int(11) NOT NULL, -- foreign key references additional_fields(id)
3420
  `record_id` int(11) NOT NULL, -- record_id
3421
  `value` varchar(255) NOT NULL DEFAULT '', -- value for this field
3422
  PRIMARY KEY (`id`),
3423
  UNIQUE KEY `field_record` (`field_id`,`record_id`),
3424
  CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
3425
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3426
3396
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
3427
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
3397
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
3428
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
3398
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
3429
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
(-)a/installer/data/mysql/updatedatabase.pl (-2 / +33 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 7912-7917 if ( CheckVersion($DBversion) ) { Link Here
7912
    SetVersion($DBversion);
7911
    SetVersion($DBversion);
7913
}
7912
}
7914
7913
7914
7915
7916
7917
7918
$DBversion = "3.15.00.XXX";
7919
if ( CheckVersion($DBversion) ) {
7920
    $dbh->do(q|
7921
        CREATE TABLE `additional_fields` (
7922
          `id` int(11) NOT NULL AUTO_INCREMENT,
7923
          `tablename` varchar(255) NOT NULL DEFAULT '',
7924
          `name` varchar(255) NOT NULL DEFAULT '',
7925
          `authorised_value_category` varchar(16) NOT NULL DEFAULT '',
7926
          `marcfield` varchar(16) NOT NULL DEFAULT '',
7927
          `searchable` tinyint(1) NOT NULL DEFAULT '0',
7928
          PRIMARY KEY (`id`),
7929
          UNIQUE KEY `fields_uniq` (`tablename`,`name`)
7930
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8
7931
    |);
7932
    $dbh->do(q|
7933
        CREATE TABLE `additional_field_values` (
7934
          `id` int(11) NOT NULL AUTO_INCREMENT,
7935
          `field_id` int(11) NOT NULL,
7936
          `record_id` int(11) NOT NULL,
7937
          `value` varchar(255) NOT NULL DEFAULT '',
7938
          PRIMARY KEY (`id`),
7939
          UNIQUE KEY `field_record` (`field_id`,`record_id`),
7940
          CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
7941
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8
7942
    |);
7943
    print "Upgrade to $DBversion done (Bug 10855: Add tables additional_fields and additional_field_values)\n";
7944
    SetVersion($DBversion);
7945
}
7946
7915
=head1 FUNCTIONS
7947
=head1 FUNCTIONS
7916
7948
7917
=head2 TableExists($table)
7949
=head2 TableExists($table)
7918
- 

Return to bug 10855