added database patchs to the updater/updatedatabase script
changes the type of the datesent and datearrived fields in the branchtransfers table from date to datetime. completely re-organises the branchcategories table. As this has previously been unused it shouldnt effect anyone.
This commit is contained in:
parent
3b469c430f
commit
8c792b7917
1 changed files with 49 additions and 0 deletions
|
@ -104,6 +104,55 @@ unless ($itemtypes{'barcode'} eq 'varchar(20)') {
|
|||
}
|
||||
}
|
||||
|
||||
# extending the timestamp in branchtransfers...
|
||||
my %branchtransfers;
|
||||
|
||||
my $sth=$dbh->prepare("show columns from branchtransfers");
|
||||
$sth->execute;
|
||||
while (my ($column, $type, $null, $key, $default, $extra) = $sth->fetchrow) {
|
||||
$branchtransfers{$column}=$type;
|
||||
}
|
||||
|
||||
unless ($branchtransfers{'datesent'} eq 'datetime') {
|
||||
print "Setting type of datesent in branchtransfers to datetime.\n";
|
||||
my $sti=$dbh->prepare("alter table branchtransfers change datesent datesent datetime");
|
||||
$sti->execute;
|
||||
}
|
||||
|
||||
unless ($branchtransfers{'datearrived'} eq 'datetime') {
|
||||
print "Setting type of datearrived in branchtransfers to datetime.\n";
|
||||
my $sti=$dbh->prepare("alter table branchtransfers change datearrived datearrived datetime");
|
||||
$sti->execute;
|
||||
}
|
||||
|
||||
# changing the branchcategories table around...
|
||||
my %branchcategories;
|
||||
|
||||
my $sth=$dbh->prepare("show columns from branchcategories");
|
||||
$sth->execute;
|
||||
while (my ($column, $type, $null, $key, $default, $extra) = $sth->fetchrow) {
|
||||
$branchcategories{$column}=$type;
|
||||
}
|
||||
|
||||
unless ($branchcategories{'categorycode'} eq 'varchar(4)') {
|
||||
print "Setting type of categorycode in branchcategories to varchar(4),\n and making the primary key.\n";
|
||||
my $sti=$dbh->prepare("alter table branchcategories change categorycode categorycode varchar(4) not null");
|
||||
$sti->execute;
|
||||
$sti=$dbh->prepare("alter table branchcategories add primary key (categorycode)");
|
||||
$sti->execute;
|
||||
}
|
||||
|
||||
unless ($branchcategories{'branchcode'} eq 'varchar(4)') {
|
||||
print "Setting type of branchcode in branchcategories to varchar(4).\n";
|
||||
my $sti=$dbh->prepare("alter table branchcategories change branchcode branchcode varchar(4)");
|
||||
$sti->execute;
|
||||
}
|
||||
|
||||
unless ($branchcategories{'codedescription'} eq 'text') {
|
||||
print "Replacing branchholding in branchcategories with codedescription text.\n";
|
||||
my $sti=$dbh->prepare("alter table branchcategories change branchholding codedescription text");
|
||||
$sti->execute;
|
||||
}
|
||||
|
||||
$sth->finish;
|
||||
$dbh->disconnect;
|
||||
|
|
Loading…
Reference in a new issue