Bug 10855: DBRev 3.21.00.032

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomas Cohen Arazi 2015-10-02 15:22:10 -03:00
parent 3eb355e892
commit 6f81f8a0e2
3 changed files with 30 additions and 21 deletions

View File

@ -29,7 +29,7 @@ use vars qw{ $VERSION };
# - #4 : the developer version. The 4th number is the database subversion.
# used by developers when the database changes. updatedatabase take care of the changes itself
# and is automatically called by Auth.pm when needed.
$VERSION = "3.21.00.031";
$VERSION = "3.21.00.032";
sub version {
return $VERSION;

View File

@ -1,20 +0,0 @@
CREATE TABLE `additional_fields` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`tablename` varchar(255) NOT NULL DEFAULT '',
`name` varchar(255) NOT NULL DEFAULT '',
`authorised_value_category` varchar(16) NOT NULL DEFAULT '',
`marcfield` varchar(16) NOT NULL DEFAULT '',
`searchable` tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `fields_uniq` (`tablename`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
CREATE TABLE `additional_field_values` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`field_id` int(11) NOT NULL,
`record_id` int(11) NOT NULL,
`value` varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (`id`),
UNIQUE KEY `field_record` (`field_id`,`record_id`),
CONSTRAINT `afv_fk` FOREIGN KEY (`field_id`) REFERENCES `additional_fields` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;

View File

@ -10957,6 +10957,35 @@ if ( CheckVersion($DBversion) ) {
SetVersion($DBversion);
}
$DBversion = "3.21.00.032";
if ( CheckVersion($DBversion) ) {
$dbh->do(q{
CREATE TABLE additional_fields (
id int(11) NOT NULL AUTO_INCREMENT,
tablename varchar(255) NOT NULL DEFAULT '',
name varchar(255) NOT NULL DEFAULT '',
authorised_value_category varchar(16) NOT NULL DEFAULT '',
marcfield varchar(16) NOT NULL DEFAULT '',
searchable tinyint(1) NOT NULL DEFAULT '0',
PRIMARY KEY (id),
UNIQUE KEY fields_uniq (tablename,name)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
});
$dbh->do(q{
CREATE TABLE additional_field_values (
id int(11) NOT NULL AUTO_INCREMENT,
field_id int(11) NOT NULL,
record_id int(11) NOT NULL,
value varchar(255) NOT NULL DEFAULT '',
PRIMARY KEY (id),
UNIQUE KEY field_record (field_id,record_id),
CONSTRAINT afv_fk FOREIGN KEY (field_id) REFERENCES additional_fields (id) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci
});
print "Upgrade to $DBversion done (Bug 10855: Additional fields for subscriptions)\n";
SetVersion($DBversion);
}
# DEVELOPER PROCESS, search for anything to execute in the db_update directory
# SEE bug 13068
# if there is anything in the atomicupdate, read and execute it.