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

(-)a/installer/data/mysql/kohastructure.sql (+31 lines)
Lines 3504-3509 CREATE TABLE items_search_fields ( Link Here
3504
    ON DELETE SET NULL ON UPDATE CASCADE
3504
    ON DELETE SET NULL ON UPDATE CASCADE
3505
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
3505
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
3506
3506
3507
--
3508
-- Table structure for table additional_fields
3509
-- This table add the ability to add new fields for a record
3510
--
3511
3512
CREATE TABLE `additional_fields` (
3513
  `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
3514
  `tablename` varchar(255) NOT NULL DEFAULT '', -- tablename of the new field
3515
  `name` varchar(255) NOT NULL DEFAULT '', -- name of the field
3516
  `authorised_value_category` varchar(16) NOT NULL DEFAULT '', -- is an authorised value category
3517
  `marcfield` varchar(16) NOT NULL DEFAULT '', -- contains the marc field to copied into the record
3518
  `searchable` tinyint(1) NOT NULL DEFAULT '0', -- is the field searchable?
3519
  PRIMARY KEY (`id`),
3520
  UNIQUE KEY `fields_uniq` (`tablename`,`name`)
3521
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
3522
3523
--
3524
-- Table structure for table additional_field_values
3525
-- This table store values for additional fields
3526
--
3527
3528
CREATE TABLE `additional_field_values` (
3529
  `id` int(11) NOT NULL AUTO_INCREMENT, -- primary key identifier
3530
  `field_id` int(11) NOT NULL, -- foreign key references additional_fields(id)
3531
  `record_id` int(11) NOT NULL, -- record_id
3532
  `value` varchar(255) NOT NULL DEFAULT '', -- value for this field
3533
  PRIMARY KEY (`id`),
3534
  UNIQUE KEY `field_record` (`field_id`,`record_id`),
3535
  CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
3536
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
3537
3507
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
3538
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
3508
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
3539
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
3509
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
3540
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +31 lines)
Lines 9790-9795 if(CheckVersion($DBversion)) { Link Here
9790
    });
9790
    });
9791
9791
9792
    print "Upgrade to $DBversion done (Bug 13523 - Remove NOT NULL restriction on field marcxml due to mysql STRICT_TRANS_TABLES)\n";
9792
    print "Upgrade to $DBversion done (Bug 13523 - Remove NOT NULL restriction on field marcxml due to mysql STRICT_TRANS_TABLES)\n";
9793
    SetVersion ($DBversion);
9794
}
9795
9796
9797
9798
$DBversion = "3.19.00.XXX";
9799
if ( CheckVersion($DBversion) ) {
9800
    $dbh->do(q|
9801
        CREATE TABLE `additional_fields` (
9802
          `id` int(11) NOT NULL AUTO_INCREMENT,
9803
          `tablename` varchar(255) NOT NULL DEFAULT '',
9804
          `name` varchar(255) NOT NULL DEFAULT '',
9805
          `authorised_value_category` varchar(16) NOT NULL DEFAULT '',
9806
          `marcfield` varchar(16) NOT NULL DEFAULT '',
9807
          `searchable` tinyint(1) NOT NULL DEFAULT '0',
9808
          PRIMARY KEY (`id`),
9809
          UNIQUE KEY `fields_uniq` (`tablename`,`name`)
9810
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
9811
    |);
9812
    $dbh->do(q|
9813
        CREATE TABLE `additional_field_values` (
9814
          `id` int(11) NOT NULL AUTO_INCREMENT,
9815
          `field_id` int(11) NOT NULL,
9816
          `record_id` int(11) NOT NULL,
9817
          `value` varchar(255) NOT NULL DEFAULT '',
9818
          PRIMARY KEY (`id`),
9819
          UNIQUE KEY `field_record` (`field_id`,`record_id`),
9820
          CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
9821
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
9822
    |);
9823
    print "Upgrade to $DBversion done (Bug 10855: Add tables additional_fields and additional_field_values)\n";
9793
    SetVersion($DBversion);
9824
    SetVersion($DBversion);
9794
}
9825
}
9795
9826
9796
- 

Return to bug 10855