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

(-)a/installer/data/mysql/kohastructure.sql (+30 lines)
Lines 3275-3280 ALTER TABLE `patron_list_patrons` Link Here
3275
  ADD CONSTRAINT patron_list_patrons_ibfk_1 FOREIGN KEY (patron_list_id) REFERENCES patron_lists (patron_list_id) ON DELETE CASCADE ON UPDATE CASCADE,
3275
  ADD CONSTRAINT patron_list_patrons_ibfk_1 FOREIGN KEY (patron_list_id) REFERENCES patron_lists (patron_list_id) ON DELETE CASCADE ON UPDATE CASCADE,
3276
  ADD CONSTRAINT patron_list_patrons_ibfk_2 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE;
3276
  ADD CONSTRAINT patron_list_patrons_ibfk_2 FOREIGN KEY (borrowernumber) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE;
3277
3277
3278
--
3279
-- Table structure for table addition_fields
3280
-- This table add the ability to add new fields for a record
3281
--
3282
3283
CREATE TABLE `additional_fields` (
3284
  `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
3285
  `tablename` varchar(255) NOT NULL DEFAULT '', -- tablename of the new field
3286
  `name` varchar(255) NOT NULL DEFAULT '', -- name of the field
3287
  `authorised_value_category` varchar(16) NOT NULL DEFAULT '', -- is an authorised value category
3288
  `marcfield` varchar(16) NOT NULL DEFAULT '', -- contains the marc field to copied into the record
3289
  `searchable` tinyint(1) NOT NULL DEFAULT '0', -- is the field searchable?
3290
  PRIMARY KEY (`id`),
3291
  UNIQUE KEY `fields_uniq` (`tablename`,`name`)
3292
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
3293
3294
--
3295
-- Table structure for table addition_field_values
3296
-- This table store values for additional fields
3297
--
3298
3299
CREATE TABLE `additional_field_values` (
3300
  `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
3301
  `field_id` int(11) NOT NULL, -- foreign key references addition_fields(id)
3302
  `record_id` int(11) NOT NULL, -- record_id
3303
  `value` varchar(255) NOT NULL DEFAULT '', -- value for this field
3304
  PRIMARY KEY (`id`),
3305
  UNIQUE KEY `field_record` (`field_id`,`record_id`),
3306
  CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
3307
) ENGINE=InnoDB DEFAULT CHARSET=utf8 |
3278
3308
3279
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
3309
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
3280
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
3310
/*!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 7306-7311 if ( CheckVersion($DBversion) ) { Link Here
7306
    SetVersion($DBversion);
7305
    SetVersion($DBversion);
7307
}
7306
}
7308
7307
7308
7309
7310
7311
7312
7313
7314
7315
7316
7317
$DBversion = "3.13.00.XXX";
7318
if ( CheckVersion($DBversion) ) {
7319
    $dbh->do(q|
7320
        CREATE TABLE `additional_fields` (
7321
          `id` int(11) NOT NULL AUTO_INCREMENT,
7322
          `tablename` varchar(255) NOT NULL DEFAULT '',
7323
          `name` varchar(255) NOT NULL DEFAULT '',
7324
          `authorised_value_category` varchar(16) NOT NULL DEFAULT '',
7325
          `marcfield` varchar(16) NOT NULL DEFAULT '',
7326
          `searchable` tinyint(1) NOT NULL DEFAULT '0',
7327
          PRIMARY KEY (`id`),
7328
          UNIQUE KEY `fields_uniq` (`tablename`,`name`)
7329
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8
7330
    |);
7331
    $dbh->do(q|
7332
        CREATE TABLE `additional_field_values` (
7333
          `id` int(11) NOT NULL AUTO_INCREMENT,
7334
          `field_id` int(11) NOT NULL,
7335
          `record_id` int(11) NOT NULL,
7336
          `value` varchar(255) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '',
7337
          PRIMARY KEY (`id`),
7338
          UNIQUE KEY `field_record` (`field_id`,`record_id`),
7339
          CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
7340
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8
7341
    |);
7342
    print "Upgrade to $DBversion done (Bug 10855: Add tables additional_fields and additional_field_values)\n";
7343
    SetVersion($DBversion);
7344
}
7345
7309
=head1 FUNCTIONS
7346
=head1 FUNCTIONS
7310
7347
7311
=head2 TableExists($table)
7348
=head2 TableExists($table)
7312
- 

Return to bug 10855