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

(-)a/installer/data/mysql/updatedatabase.pl (-92 / +105 lines)
Lines 16533-16539 $DBversion = '18.06.00.037'; Link Here
16533
if( CheckVersion( $DBversion ) ) {
16533
if( CheckVersion( $DBversion ) ) {
16534
    unless (TableExists('branches_overdrive')){
16534
    unless (TableExists('branches_overdrive')){
16535
        $dbh->do( q|
16535
        $dbh->do( q|
16536
            CREATE TABLE IF NOT EXISTS branches_overdrive (
16536
            CREATE TABLE branches_overdrive (
16537
                `branchcode` VARCHAR( 10 ) NOT NULL ,
16537
                `branchcode` VARCHAR( 10 ) NOT NULL ,
16538
                `authname` VARCHAR( 255 ) NOT NULL ,
16538
                `authname` VARCHAR( 255 ) NOT NULL ,
16539
                PRIMARY KEY (`branchcode`) ,
16539
                PRIMARY KEY (`branchcode`) ,
Lines 19527-19566 if ( CheckVersion($DBversion) ) { Link Here
19527
$DBversion = '19.06.00.030';
19527
$DBversion = '19.06.00.030';
19528
if( CheckVersion( $DBversion ) ) {
19528
if( CheckVersion( $DBversion ) ) {
19529
19529
19530
    $dbh->do(q|
19530
    if ( !TableExists('club_holds') ) {
19531
        CREATE TABLE IF NOT EXISTS club_holds (
19531
        $dbh->do(q|
19532
            id        INT(11) NOT NULL AUTO_INCREMENT,
19532
            CREATE TABLE club_holds (
19533
            club_id   INT(11) NOT NULL, -- id for the club the hold was generated for
19533
                id        INT(11) NOT NULL AUTO_INCREMENT,
19534
            biblio_id INT(11) NOT NULL, -- id for the bibliographic record the hold has been placed against
19534
                club_id   INT(11) NOT NULL, -- id for the club the hold was generated for
19535
            item_id   INT(11) NULL DEFAULT NULL, -- If item-level, the id for the item the hold has been placed agains
19535
                biblio_id INT(11) NOT NULL, -- id for the bibliographic record the hold has been placed against
19536
            date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- Timestamp for the placed hold
19536
                item_id   INT(11) NULL DEFAULT NULL, -- If item-level, the id for the item the hold has been placed agains
19537
            PRIMARY KEY (id),
19537
                date_created TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, -- Timestamp for the placed hold
19538
            -- KEY club_id (club_id),
19538
                PRIMARY KEY (id),
19539
            CONSTRAINT clubs_holds_ibfk_1 FOREIGN KEY (club_id)   REFERENCES clubs  (id) ON DELETE CASCADE ON UPDATE CASCADE,
19539
                -- KEY club_id (club_id),
19540
            CONSTRAINT clubs_holds_ibfk_2 FOREIGN KEY (biblio_id) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE,
19540
                CONSTRAINT clubs_holds_ibfk_1 FOREIGN KEY (club_id)   REFERENCES clubs  (id) ON DELETE CASCADE ON UPDATE CASCADE,
19541
            CONSTRAINT clubs_holds_ibfk_3 FOREIGN KEY (item_id)   REFERENCES items  (itemnumber) ON DELETE CASCADE ON UPDATE CASCADE
19541
                CONSTRAINT clubs_holds_ibfk_2 FOREIGN KEY (biblio_id) REFERENCES biblio (biblionumber) ON DELETE CASCADE ON UPDATE CASCADE,
19542
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
19542
                CONSTRAINT clubs_holds_ibfk_3 FOREIGN KEY (item_id)   REFERENCES items  (itemnumber) ON DELETE CASCADE ON UPDATE CASCADE
19543
    |);
19543
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
19544
        |);
19545
    }
19544
19546
19545
    $dbh->do(q|
19547
    if ( !TableExists('club_holds_to_patron_holds') ) {
19546
        CREATE TABLE IF NOT EXISTS club_holds_to_patron_holds (
19548
        $dbh->do(q|
19547
            id              INT(11) NOT NULL AUTO_INCREMENT,
19549
            CREATE TABLE club_holds_to_patron_holds (
19548
            club_hold_id    INT(11) NOT NULL,
19550
                id              INT(11) NOT NULL AUTO_INCREMENT,
19549
            patron_id       INT(11) NOT NULL,
19551
                club_hold_id    INT(11) NOT NULL,
19550
            hold_id         INT(11),
19552
                patron_id       INT(11) NOT NULL,
19551
            error_code      ENUM ( 'damaged', 'ageRestricted', 'itemAlreadyOnHold',
19553
                hold_id         INT(11),
19552
                                'tooManyHoldsForThisRecord', 'tooManyReservesToday',
19554
                error_code      ENUM ( 'damaged', 'ageRestricted', 'itemAlreadyOnHold',
19553
                                'tooManyReserves', 'notReservable', 'cannotReserveFromOtherBranches',
19555
                                    'tooManyHoldsForThisRecord', 'tooManyReservesToday',
19554
                                'libraryNotFound', 'libraryNotPickupLocation', 'cannotBeTransferred'
19556
                                    'tooManyReserves', 'notReservable', 'cannotReserveFromOtherBranches',
19555
                            ) NULL DEFAULT NULL,
19557
                                    'libraryNotFound', 'libraryNotPickupLocation', 'cannotBeTransferred'
19556
            error_message   varchar(100) NULL DEFAULT NULL,
19558
                                ) NULL DEFAULT NULL,
19557
            PRIMARY KEY (id),
19559
                error_message   varchar(100) NULL DEFAULT NULL,
19558
            -- KEY club_hold_id (club_hold_id),
19560
                PRIMARY KEY (id),
19559
            CONSTRAINT clubs_holds_paton_holds_ibfk_1 FOREIGN KEY (club_hold_id) REFERENCES club_holds (id) ON DELETE CASCADE ON UPDATE CASCADE,
19561
                -- KEY club_hold_id (club_hold_id),
19560
            CONSTRAINT clubs_holds_paton_holds_ibfk_2 FOREIGN KEY (patron_id) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
19562
                CONSTRAINT clubs_holds_paton_holds_ibfk_1 FOREIGN KEY (club_hold_id) REFERENCES club_holds (id) ON DELETE CASCADE ON UPDATE CASCADE,
19561
            CONSTRAINT clubs_holds_paton_holds_ibfk_3 FOREIGN KEY (hold_id) REFERENCES reserves (reserve_id) ON DELETE CASCADE ON UPDATE CASCADE
19563
                CONSTRAINT clubs_holds_paton_holds_ibfk_2 FOREIGN KEY (patron_id) REFERENCES borrowers (borrowernumber) ON DELETE CASCADE ON UPDATE CASCADE,
19562
        ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
19564
                CONSTRAINT clubs_holds_paton_holds_ibfk_3 FOREIGN KEY (hold_id) REFERENCES reserves (reserve_id) ON DELETE CASCADE ON UPDATE CASCADE
19563
    |);
19565
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
19566
        |);
19567
    }
19564
19568
19565
    # Always end with this (adjust the bug info)
19569
    # Always end with this (adjust the bug info)
19566
    SetVersion( $DBversion );
19570
    SetVersion( $DBversion );
Lines 19733-19763 $DBversion = '19.06.00.043'; Link Here
19733
if ( CheckVersion($DBversion) ) {
19737
if ( CheckVersion($DBversion) ) {
19734
19738
19735
    # Adding account_debit_types
19739
    # Adding account_debit_types
19736
    $dbh->do(
19740
    if ( !TableExists('account_debit_types') ) {
19737
        qq{
19741
        $dbh->do(
19738
            CREATE TABLE IF NOT EXISTS account_debit_types (
19742
            qq{
19739
              code varchar(80) NOT NULL,
19743
                CREATE TABLE account_debit_types (
19740
              description varchar(200) NULL,
19744
                  code varchar(80) NOT NULL,
19741
              can_be_added_manually tinyint(4) NOT NULL DEFAULT 1,
19745
                  description varchar(200) NULL,
19742
              default_amount decimal(28, 6) NULL,
19746
                  can_be_added_manually tinyint(4) NOT NULL DEFAULT 1,
19743
              is_system tinyint(1) NOT NULL DEFAULT 0,
19747
                  default_amount decimal(28, 6) NULL,
19744
              archived tinyint(1) NOT NULL DEFAULT 0,
19748
                  is_system tinyint(1) NOT NULL DEFAULT 0,
19745
              PRIMARY KEY (code)
19749
                  archived tinyint(1) NOT NULL DEFAULT 0,
19746
            ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci
19750
                  PRIMARY KEY (code)
19747
          }
19751
                ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci
19748
    );
19752
              }
19753
        );
19754
    }
19749
19755
19750
    # Adding account_debit_types_branches
19756
    # Adding account_debit_types_branches
19751
    $dbh->do(
19757
    if ( !TableExists('account_debit_types_branches') ) {
19752
        qq{
19758
        $dbh->do(
19753
            CREATE TABLE IF NOT EXISTS account_debit_types_branches (
19759
            qq{
19754
                debit_type_code VARCHAR(80),
19760
                CREATE TABLE account_debit_types_branches (
19755
                branchcode VARCHAR(10),
19761
                    debit_type_code VARCHAR(80),
19756
                FOREIGN KEY (debit_type_code) REFERENCES account_debit_types(code) ON DELETE CASCADE,
19762
                    branchcode VARCHAR(10),
19757
                FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE
19763
                    FOREIGN KEY (debit_type_code) REFERENCES account_debit_types(code) ON DELETE CASCADE,
19758
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
19764
                    FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE
19759
        }
19765
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
19760
    );
19766
            }
19767
        );
19768
    }
19761
19769
19762
    # Populating account_debit_types
19770
    # Populating account_debit_types
19763
    $dbh->do(
19771
    $dbh->do(
Lines 19956-19984 $DBversion = '19.06.00.044'; Link Here
19956
if ( CheckVersion($DBversion) ) {
19964
if ( CheckVersion($DBversion) ) {
19957
19965
19958
    # Adding account_credit_types
19966
    # Adding account_credit_types
19959
    $dbh->do(
19967
    if ( !TableExists('account_credit_types') ) {
19960
        qq{
19968
        $dbh->do(
19961
            CREATE TABLE IF NOT EXISTS account_credit_types (
19969
            qq{
19962
              code varchar(80) NOT NULL,
19970
                CREATE TABLE account_credit_types (
19963
              description varchar(200) NULL,
19971
                  code varchar(80) NOT NULL,
19964
              can_be_added_manually tinyint(4) NOT NULL DEFAULT 1,
19972
                  description varchar(200) NULL,
19965
              is_system tinyint(1) NOT NULL DEFAULT 0,
19973
                  can_be_added_manually tinyint(4) NOT NULL DEFAULT 1,
19966
              PRIMARY KEY (code)
19974
                  is_system tinyint(1) NOT NULL DEFAULT 0,
19967
            ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci
19975
                  PRIMARY KEY (code)
19968
          }
19976
                ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci
19969
    );
19977
              }
19978
        );
19979
    }
19970
19980
19971
    # Adding account_credit_types_branches
19981
    # Adding account_credit_types_branches
19972
    $dbh->do(
19982
    if ( !TableExists('account_credit_types_branches') ) {
19973
        qq{
19983
        $dbh->do(
19974
            CREATE TABLE IF NOT EXISTS account_credit_types_branches (
19984
            qq{
19975
                credit_type_code VARCHAR(80),
19985
                CREATE TABLE account_credit_types_branches (
19976
                branchcode VARCHAR(10),
19986
                    credit_type_code VARCHAR(80),
19977
                FOREIGN KEY (credit_type_code) REFERENCES account_credit_types(code) ON DELETE CASCADE,
19987
                    branchcode VARCHAR(10),
19978
                FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE
19988
                    FOREIGN KEY (credit_type_code) REFERENCES account_credit_types(code) ON DELETE CASCADE,
19979
            ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
19989
                    FOREIGN KEY (branchcode) REFERENCES branches(branchcode) ON DELETE CASCADE
19980
        }
19990
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
19981
    );
19991
            }
19992
        );
19993
    }
19982
19994
19983
    # Populating account_credit_types
19995
    # Populating account_credit_types
19984
    $dbh->do(
19996
    $dbh->do(
Lines 20959-20977 $DBversion = '19.12.00.033'; Link Here
20959
if ( CheckVersion($DBversion) ) {
20971
if ( CheckVersion($DBversion) ) {
20960
20972
20961
    # Add cash_register_actions table
20973
    # Add cash_register_actions table
20962
    $dbh->do(qq{
20974
    if ( !TableExists('cash_register_actions') ) {
20963
        CREATE TABLE  IF NOT EXISTS `cash_register_actions` (
20975
        $dbh->do(qq{
20964
          `id` int(11) NOT NULL auto_increment, -- unique identifier for each account register action
20976
            CREATE TABLE `cash_register_actions` (
20965
          `code` varchar(24) NOT NULL, -- action code denoting the type of action recorded (enum),
20977
              `id` int(11) NOT NULL auto_increment, -- unique identifier for each account register action
20966
          `register_id` int(11) NOT NULL, -- id of cash_register this action belongs to,
20978
              `code` varchar(24) NOT NULL, -- action code denoting the type of action recorded (enum),
20967
          `manager_id` int(11) NOT NULL, -- staff member performing the action
20979
              `register_id` int(11) NOT NULL, -- id of cash_register this action belongs to,
20968
          `amount` decimal(28,6) DEFAULT NULL, -- amount recorded in action (signed)
20980
              `manager_id` int(11) NOT NULL, -- staff member performing the action
20969
          `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
20981
              `amount` decimal(28,6) DEFAULT NULL, -- amount recorded in action (signed)
20970
          PRIMARY KEY (`id`),
20982
              `timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
20971
          CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
20983
              PRIMARY KEY (`id`),
20972
          CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
20984
              CONSTRAINT `cash_register_actions_manager` FOREIGN KEY (`manager_id`) REFERENCES `borrowers` (`borrowernumber`) ON DELETE CASCADE ON UPDATE CASCADE,
20973
        ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
20985
              CONSTRAINT `cash_register_actions_register` FOREIGN KEY (`register_id`) REFERENCES `cash_registers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE
20974
    });
20986
            ) ENGINE = InnoDB DEFAULT CHARSET = utf8mb4 COLLATE = utf8mb4_unicode_ci;
20987
        });
20988
    }
20975
20989
20976
    # Add cashup permission
20990
    # Add cashup permission
20977
    $dbh->do(qq{
20991
    $dbh->do(qq{
20978
- 

Return to bug 24994