Lines 3507-3516
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
Link Here
|
3507 |
|
3507 |
|
3508 |
$DBversion = '3.01.00.118'; |
3508 |
$DBversion = '3.01.00.118'; |
3509 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
3509 |
if (C4::Context->preference("Version") < TransformToNum($DBversion)) { |
3510 |
my ($count) = $dbh->selectrow_array("SELECT count(*) FROM information_schema.columns |
3510 |
unless ( column_exists('aqbudgets_planning', 'display') ) { |
3511 |
WHERE table_name = 'aqbudgets_planning' |
|
|
3512 |
AND column_name = 'display'"); |
3513 |
if ($count < 1) { |
3514 |
$dbh->do("ALTER TABLE aqbudgets_planning ADD COLUMN display tinyint(1) DEFAULT 1"); |
3511 |
$dbh->do("ALTER TABLE aqbudgets_planning ADD COLUMN display tinyint(1) DEFAULT 1"); |
3515 |
} |
3512 |
} |
3516 |
print "Upgrade to $DBversion done (bug 4203: add display column to aqbudgets_planning if missing)\n"; |
3513 |
print "Upgrade to $DBversion done (bug 4203: add display column to aqbudgets_planning if missing)\n"; |
Lines 4071-4085
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
Link Here
|
4071 |
# this attempts to fix that |
4068 |
# this attempts to fix that |
4072 |
$DBversion = '3.03.00.023'; |
4069 |
$DBversion = '3.03.00.023'; |
4073 |
if (C4::Context->preference("Version") < TransformToNum($DBversion) && $original_version < TransformToNum("3.02.05.002")) { |
4070 |
if (C4::Context->preference("Version") < TransformToNum($DBversion) && $original_version < TransformToNum("3.02.05.002")) { |
4074 |
my $sth = $dbh->prepare("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'aqbasketgroups' AND COLUMN_NAME = 'billingplace'"); |
4071 |
$dbh->do("ALTER TABLE aqbasketgroups ADD billingplace VARCHAR(10)") unless column_exists('aqbasketgroups', 'billingplace') |
4075 |
$sth->execute; |
4072 |
$dbh->do("ALTER TABLE aqbasketgroups ADD deliveryplace VARCHAR(10)") unless column_exists('aqbasketgroups', 'deliveryplace'); |
4076 |
$dbh->do("ALTER TABLE aqbasketgroups ADD billingplace VARCHAR(10)") if ! $sth->fetchrow_hashref; |
4073 |
$dbh->do("ALTER TABLE aqbasketgroups ADD deliverycomment VARCHAR(255)") unless column_exists('aqbasketgroups', 'deliverycomment'); |
4077 |
$sth = $dbh->prepare("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'aqbasketgroups' AND COLUMN_NAME = 'deliveryplace'"); |
4074 |
|
4078 |
$sth->execute; |
|
|
4079 |
$dbh->do("ALTER TABLE aqbasketgroups ADD deliveryplace VARCHAR(10)") if ! $sth->fetchrow_hashref; |
4080 |
$sth = $dbh->prepare("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'aqbasketgroups' AND COLUMN_NAME = 'deliverycomment'"); |
4081 |
$sth->execute; |
4082 |
$dbh->do("ALTER TABLE aqbasketgroups ADD deliverycomment VARCHAR(255)") if ! $sth->fetchrow_hashref; |
4083 |
print "Upgrade to $DBversion done (Reconcile aqbasketgroups)\n"; |
4075 |
print "Upgrade to $DBversion done (Reconcile aqbasketgroups)\n"; |
4084 |
SetVersion ($DBversion); |
4076 |
SetVersion ($DBversion); |
4085 |
} |
4077 |
} |
Lines 5570-5588
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
Link Here
|
5570 |
$dbh->do('DROP TABLE tmp_reserves'); |
5562 |
$dbh->do('DROP TABLE tmp_reserves'); |
5571 |
$dbh->do('COMMIT'); |
5563 |
$dbh->do('COMMIT'); |
5572 |
|
5564 |
|
5573 |
my $sth = $dbh->prepare(" |
5565 |
die("Failed to add reserve_id to reserves tables, please refresh the page to try again.") unless primary_key_exists('reserves', 'reserve_id'); |
5574 |
SELECT COUNT( * ) AS count |
|
|
5575 |
FROM information_schema.COLUMNS |
5576 |
WHERE COLUMN_NAME = 'reserve_id' |
5577 |
AND ( |
5578 |
TABLE_NAME LIKE 'reserves' |
5579 |
OR |
5580 |
TABLE_NAME LIKE 'old_reserves' |
5581 |
) |
5582 |
"); |
5583 |
$sth->execute(); |
5584 |
my $row = $sth->fetchrow_hashref(); |
5585 |
die("Failed to add reserve_id to reserves tables, please refresh the page to try again.") unless ( $row->{'count'} ); |
5586 |
|
5566 |
|
5587 |
print "Upgrade to $DBversion done (add reserve_id to reserves & old_reserves tables)\n"; |
5567 |
print "Upgrade to $DBversion done (add reserve_id to reserves & old_reserves tables)\n"; |
5588 |
SetVersion($DBversion); |
5568 |
SetVersion($DBversion); |
Lines 17161-17169
if( CheckVersion( $DBversion ) ) {
Link Here
|
17161 |
|
17141 |
|
17162 |
$DBversion = '18.12.00.002'; |
17142 |
$DBversion = '18.12.00.002'; |
17163 |
if( CheckVersion( $DBversion ) ) { |
17143 |
if( CheckVersion( $DBversion ) ) { |
17164 |
my $sth = $dbh->prepare(q|SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS WHERE CONSTRAINT_NAME='accountlines_ibfk_1'|); |
17144 |
if ( foreign_key_exists('accountlines', 'accountlines_ibfk_1') ) { |
17165 |
$sth->execute; |
|
|
17166 |
if ($sth->fetchrow_hashref) { |
17167 |
$dbh->do(q| |
17145 |
$dbh->do(q| |
17168 |
ALTER TABLE accountlines DROP FOREIGN KEY accountlines_ibfk_1; |
17146 |
ALTER TABLE accountlines DROP FOREIGN KEY accountlines_ibfk_1; |
17169 |
|); |
17147 |
|); |
17170 |
- |
|
|