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

(-)a/installer/data/mysql/kohastructure.sql (+31 lines)
Lines 3387-3392 CREATE TABLE IF NOT EXISTS marc_modification_template_actions ( Link Here
3387
  CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
3387
  CONSTRAINT `mmta_ibfk_1` FOREIGN KEY (`template_id`) REFERENCES `marc_modification_templates` (`template_id`) ON DELETE CASCADE ON UPDATE CASCADE
3388
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
3388
) ENGINE=InnoDB  DEFAULT CHARSET=utf8;
3389
3389
3390
--
3391
-- Table structure for table additional_fields
3392
-- This table add the ability to add new fields for a record
3393
--
3394
3395
CREATE TABLE `additional_fields` (
3396
  `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
3397
  `tablename` varchar(255) NOT NULL DEFAULT '', -- tablename of the new field
3398
  `name` varchar(255) NOT NULL DEFAULT '', -- name of the field
3399
  `authorised_value_category` varchar(16) NOT NULL DEFAULT '', -- is an authorised value category
3400
  `marcfield` varchar(16) NOT NULL DEFAULT '', -- contains the marc field to copied into the record
3401
  `searchable` tinyint(1) NOT NULL DEFAULT '0', -- is the field searchable?
3402
  PRIMARY KEY (`id`),
3403
  UNIQUE KEY `fields_uniq` (`tablename`,`name`)
3404
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3405
3406
--
3407
-- Table structure for table additional_field_values
3408
-- This table store values for additional fields
3409
--
3410
3411
CREATE TABLE `additional_field_values` (
3412
  `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
3413
  `field_id` int(11) NOT NULL, -- foreign key references additional_fields(id)
3414
  `record_id` int(11) NOT NULL, -- record_id
3415
  `value` varchar(255) NOT NULL DEFAULT '', -- value for this field
3416
  PRIMARY KEY (`id`),
3417
  UNIQUE KEY `field_record` (`field_id`,`record_id`),
3418
  CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
3419
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
3420
3390
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
3421
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
3391
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
3422
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
3392
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
3423
/*!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 8065-8070 if ( CheckVersion($DBversion) ) { Link Here
8065
    SetVersion($DBversion);
8064
    SetVersion($DBversion);
8066
}
8065
}
8067
8066
8067
8068
8069
8070
8071
$DBversion = "3.15.00.XXX";
8072
if ( CheckVersion($DBversion) ) {
8073
    $dbh->do(q|
8074
        CREATE TABLE `additional_fields` (
8075
          `id` int(11) NOT NULL AUTO_INCREMENT,
8076
          `tablename` varchar(255) NOT NULL DEFAULT '',
8077
          `name` varchar(255) NOT NULL DEFAULT '',
8078
          `authorised_value_category` varchar(16) NOT NULL DEFAULT '',
8079
          `marcfield` varchar(16) NOT NULL DEFAULT '',
8080
          `searchable` tinyint(1) NOT NULL DEFAULT '0',
8081
          PRIMARY KEY (`id`),
8082
          UNIQUE KEY `fields_uniq` (`tablename`,`name`)
8083
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8
8084
    |);
8085
    $dbh->do(q|
8086
        CREATE TABLE `additional_field_values` (
8087
          `id` int(11) NOT NULL AUTO_INCREMENT,
8088
          `field_id` int(11) NOT NULL,
8089
          `record_id` int(11) NOT NULL,
8090
          `value` varchar(255) NOT NULL DEFAULT '',
8091
          PRIMARY KEY (`id`),
8092
          UNIQUE KEY `field_record` (`field_id`,`record_id`),
8093
          CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
8094
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8
8095
    |);
8096
    print "Upgrade to $DBversion done (Bug 10855: Add tables additional_fields and additional_field_values)\n";
8097
    SetVersion($DBversion);
8098
}
8099
8068
=head1 FUNCTIONS
8100
=head1 FUNCTIONS
8069
8101
8070
=head2 TableExists($table)
8102
=head2 TableExists($table)
8071
- 

Return to bug 10855