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

(-)a/installer/data/mysql/db_revs/210600001.pl (+13 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
{
4
    bug_number => "28489",
5
    description => "Modify sessions.a_session from longtext to longblob",
6
    up => sub {
7
        my ($args) = @_;
8
        my $dbh = $args->{dbh};
9
10
        $dbh->do('DELETE FROM sessions');
11
        $dbh->do('ALTER TABLE sessions MODIFY a_session LONGBLOB NOT NULL');
12
    },
13
}
(-)a/installer/data/mysql/db_revs/210600002.pl (+28 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
{
4
    bug_number => "28490",
5
    description => "Bring back accidentally deleted relationship columns",
6
    up => sub {
7
        my ($args) = @_;
8
        my $dbh = $args->{dbh};
9
10
        if( !column_exists( 'borrower_modifications', 'relationship' ) ) {
11
          $dbh->do(q{
12
              ALTER TABLE borrower_modifications ADD COLUMN `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL AFTER `borrowernotes`
13
          });
14
        }
15
16
        if( !column_exists( 'borrowers', 'relationship' ) ) {
17
          $dbh->do(q{
18
              ALTER TABLE borrowers ADD COLUMN `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor' AFTER `borrowernotes`
19
          });
20
        }
21
22
        if( !column_exists( 'deletedborrowers', 'relationship' ) ) {
23
          $dbh->do(q{
24
              ALTER TABLE deletedborrowers ADD COLUMN `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor' AFTER `borrowernotes`
25
          });
26
        }
27
    },
28
}
(-)a/installer/data/mysql/db_revs/210600003.pl (+33 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
{
4
    bug_number => "24434",
5
    description => "Add 'WrongTransfer' to branchtransfers.cancellation_reason enum",
6
    up => sub {
7
        my ($args) = @_;
8
        my $dbh = $args->{dbh};
9
10
        # add 'wrongtransfer' to branchtransfers cancellation_reason enum
11
        $dbh->do(
12
            q{
13
                alter table
14
                    `branchtransfers`
15
                modify column
16
                    `cancellation_reason` enum(
17
                        'manual',
18
                        'stockrotationadvance',
19
                        'stockrotationrepatriation',
20
                        'returntohome',
21
                        'returntoholding',
22
                        'rotatingcollection',
23
                        'reserve',
24
                        'lostreserve',
25
                        'cancelreserve',
26
                        'itemlost',
27
                        'wrongtransfer'
28
                    )
29
                after `comments`
30
              }
31
        );
32
    },
33
}
(-)a/installer/data/mysql/db_revs/210600004.pl (+21 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
{
4
    bug_number => "15788",
5
    description => "Split edit_borrowers permission",
6
    up => sub {
7
        my ($args) = @_;
8
        my $dbh = $args->{dbh};
9
10
        $dbh->do(q{
11
            INSERT IGNORE permissions (module_bit, code, description)
12
            VALUES
13
            (4, 'delete_borrowers', 'Delete borrowers')
14
        });
15
16
        $dbh->do(q{
17
            INSERT IGNORE INTO user_permissions (borrowernumber, module_bit, code)
18
            SELECT borrowernumber, 4, 'delete_borrowers' FROM user_permissions WHERE code = 'edit_borrowers'
19
        });
20
    },
21
}
(-)a/installer/data/mysql/db_revs/210600005.pl (+15 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
{
4
    bug_number => "26205",
5
    description => "Add new system preference NewsLog to log news changes",
6
    up => sub {
7
        my ($args) = @_;
8
        my $dbh = $args->{dbh};
9
10
        $dbh->do( q{
11
            INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
12
            VALUES ('NewsLog', '0', 'If enabled, log OPAC News changes', '', 'YesNo')
13
        });
14
    },
15
}
(-)a/installer/data/mysql/updatedatabase.pl (-196 lines)
Lines 24296-24496 unless ( $ENV{HTTP_HOST} ) { # Is that correct? Link Here
24296
    }
24296
    }
24297
}
24297
}
24298
24298
24299
$DBversion = '21.06.00.001';
24300
if ( CheckVersion($DBversion) ) {
24301
    $dbh->do('DELETE FROM sessions');
24302
    $dbh->do('ALTER TABLE sessions MODIFY a_session LONGBLOB NOT NULL');
24303
24304
    NewVersion( $DBversion, '28489', 'Modify sessions.a_session from longtext to longblob' );
24305
}
24306
24307
$DBversion = '21.06.00.002';
24308
if( CheckVersion( $DBversion ) ) {
24309
    if( !column_exists( 'borrower_modifications', 'relationship' ) ) {
24310
      $dbh->do(q{
24311
          ALTER TABLE borrower_modifications ADD COLUMN `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL AFTER `borrowernotes`
24312
      });
24313
    }
24314
24315
    if( !column_exists( 'borrowers', 'relationship' ) ) {
24316
      $dbh->do(q{
24317
          ALTER TABLE borrowers ADD COLUMN `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor' AFTER `borrowernotes`
24318
      });
24319
    }
24320
24321
    if( !column_exists( 'deletedborrowers', 'relationship' ) ) {
24322
      $dbh->do(q{
24323
          ALTER TABLE deletedborrowers ADD COLUMN `relationship` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'used for children to include the relationship to their guarantor' AFTER `borrowernotes`
24324
      });
24325
    }
24326
24327
    NewVersion( $DBversion, 28490, "Bring back accidentally deleted relationship columns");
24328
}
24329
24330
$DBversion = '21.06.00.003';
24331
if( CheckVersion( $DBversion ) ) {
24332
24333
    # Add 'WrongTransfer' to branchtransfers cancellation_reason enum
24334
    $dbh->do(
24335
        q{
24336
            ALTER TABLE
24337
                `branchtransfers`
24338
            MODIFY COLUMN
24339
                `cancellation_reason` enum(
24340
                    'Manual',
24341
                    'StockrotationAdvance',
24342
                    'StockrotationRepatriation',
24343
                    'ReturnToHome',
24344
                    'ReturnToHolding',
24345
                    'RotatingCollection',
24346
                    'Reserve',
24347
                    'LostReserve',
24348
                    'CancelReserve',
24349
                    'ItemLost',
24350
                    'WrongTransfer'
24351
                )
24352
            AFTER `comments`
24353
          }
24354
    );
24355
24356
    NewVersion( $DBversion, 24434, "Add 'WrongTransfer' to branchtransfers.cancellation_reason enum");
24357
}
24358
24359
$DBversion = '21.06.00.004';
24360
if ( CheckVersion($DBversion) ) {
24361
24362
    $dbh->do(q{
24363
        INSERT IGNORE permissions (module_bit, code, description)
24364
        VALUES
24365
        (4, 'delete_borrowers', 'Delete borrowers')
24366
    });
24367
24368
    $dbh->do(q{
24369
        INSERT IGNORE INTO user_permissions (borrowernumber, module_bit, code)
24370
        SELECT borrowernumber, 4, 'delete_borrowers' FROM user_permissions WHERE code = 'edit_borrowers'
24371
    });
24372
24373
    NewVersion( $DBversion, 15788, "Split edit_borrowers permission" );
24374
}
24375
24376
$DBversion = '21.06.00.005';
24377
if( CheckVersion( $DBversion ) ) {
24378
    $dbh->do( q{
24379
        INSERT IGNORE INTO systempreferences (variable, value, explanation, options, type)
24380
        VALUES ('NewsLog', '0', 'If enabled, log OPAC News changes', '', 'YesNo')
24381
    });
24382
24383
    NewVersion( $DBversion, 26205, "Add new system preference NewsLog to log news changes");
24384
}
24385
24386
$DBversion = '21.06.00.006';
24387
if( CheckVersion( $DBversion ) ){
24388
    unless( column_exists( 'course_items', 'biblionumber') ) {
24389
        $dbh->do(q{ ALTER TABLE course_items ADD `biblionumber` int(11) AFTER `itemnumber` });
24390
24391
        $dbh->do(q{
24392
            UPDATE course_items
24393
            LEFT JOIN items ON items.itemnumber=course_items.itemnumber
24394
            SET course_items.biblionumber=items.biblionumber
24395
            WHERE items.itemnumber IS NOT NULL
24396
        });
24397
24398
        $dbh->do(q{ ALTER TABLE course_items MODIFY COLUMN `biblionumber` INT(11) NOT NULL });
24399
24400
        $dbh->do(q{ ALTER TABLE course_items ADD CONSTRAINT `fk_course_items_biblionumber` FOREIGN KEY (`biblionumber`) REFERENCES `biblio` (`biblionumber`) ON DELETE CASCADE ON UPDATE CASCADE });
24401
        $dbh->do(q{ ALTER TABLE course_items CHANGE `itemnumber` `itemnumber` int(11) DEFAULT NULL });
24402
    }
24403
24404
    NewVersion( $DBversion, 14237, ["Add course_items.biblionumber column", "Add fk_course_items_biblionumber constraint", "Change course_items.itemnumber to allow NULL values"] );
24405
}
24406
24407
$DBversion = '21.06.00.007';
24408
if( CheckVersion( $DBversion ) ) {
24409
    if( !column_exists( 'borrowers', 'primary_contact_method' ) ) {
24410
        $dbh->do( "ALTER TABLE `borrowers` ADD COLUMN `primary_contact_method` VARCHAR(45) DEFAULT NULL AFTER `autorenew_checkouts`" );
24411
    }
24412
24413
    if( !column_exists( 'deletedborrowers', 'primary_contact_method' ) ) {
24414
        $dbh->do( "ALTER TABLE `deletedborrowers` ADD COLUMN `primary_contact_method` VARCHAR(45) DEFAULT NULL AFTER `autorenew_checkouts`" );
24415
    }
24416
24417
    if( !column_exists( 'borrower_modifications', 'primary_contact_method' ) ) {
24418
        $dbh->do( "ALTER TABLE `borrower_modifications` ADD COLUMN `primary_contact_method` VARCHAR(45) DEFAULT NULL AFTER `gdpr_proc_consent`" );
24419
    }
24420
24421
    NewVersion( $DBversion, 11879, "Add a new field to patron record: main contact method");
24422
}
24423
24424
$DBversion = '21.06.00.008';
24425
if( CheckVersion( $DBversion ) ) {
24426
    $dbh->do(q{
24427
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
24428
            ('ArticleRequestsOpacHostRedirection', '0', NULL, 'Enables redirection from child to host when requesting article on OPAC', 'YesNo')
24429
    });
24430
    NewVersion( $DBversion, 20310, "Add pref ArticleRequestsOpacHostRedirection");
24431
}
24432
24433
$DBversion = '21.06.00.009';
24434
if( CheckVersion( $DBversion ) ) {
24435
    unless ( column_exists('article_requests', 'format') ) {
24436
        $dbh->do(q|
24437
            ALTER TABLE article_requests
24438
            ADD COLUMN `format` enum('PHOTOCOPY', 'SCAN') NOT NULL DEFAULT 'PHOTOCOPY' AFTER notes
24439
        |);
24440
    }
24441
    unless ( column_exists('article_requests', 'urls') ) {
24442
        $dbh->do(q|
24443
            ALTER TABLE article_requests
24444
            ADD COLUMN `urls` MEDIUMTEXT AFTER format
24445
        |);
24446
    }
24447
    NewVersion( $DBversion, 20472, "Add columns format and urls in article_requests table");
24448
}
24449
24450
$DBversion = '21.06.00.010';
24451
if( CheckVersion( $DBversion ) ) {
24452
    $dbh->do(q{
24453
        INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES
24454
        ('ArticleRequestsSupportedFormats', 'PHOTOCOPY', 'PHOTOCOPY|SCAN', 'List supported formats between vertical bars', 'free')
24455
    });
24456
    NewVersion( $DBversion, 20472, "Add syspref ArticleRequestsSupportedFormats");
24457
}
24458
24459
$DBversion = '21.06.00.011';
24460
if( CheckVersion( $DBversion ) ) {
24461
24462
    my @fields = qw(
24463
      branchname
24464
      branchaddress1
24465
      branchaddress2
24466
      branchaddress3
24467
      branchzip
24468
      branchcity
24469
      branchstate
24470
      branchcountry
24471
      branchphone
24472
      branchfax
24473
      branchemail
24474
      branchillemail
24475
      branchreplyto
24476
      branchreturnpath
24477
      branchurl
24478
      branchip
24479
      branchnotes
24480
      opac_info
24481
      marcorgcode
24482
    );
24483
    for my $f ( @fields ) {
24484
        $dbh->do(qq{
24485
            UPDATE branches
24486
            SET $f = NULL
24487
            WHERE $f = ""
24488
        });
24489
    }
24490
24491
    NewVersion( $DBversion, 28567, "Set to NULL empty branches fields");
24492
}
24493
24494
# SEE bug 13068
24299
# SEE bug 13068
24495
# if there is anything in the atomicupdate, read and execute it.
24300
# if there is anything in the atomicupdate, read and execute it.
24496
my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';
24301
my $update_dir = C4::Context->config('intranetdir') . '/installer/data/mysql/atomicupdate/';
24497
- 

Return to bug 25078