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

(-)a/installer/data/mysql/updatedatabase.pl (-48 lines)
Lines 19894-19906 if ( CheckVersion($DBversion) ) { Link Here
19894
        );
19894
        );
19895
    }
19895
    }
19896
19896
19897
    # Adding a check constraints to accountlines
19898
    $dbh->do(
19899
        qq{
19900
        ALTER TABLE accountlines ADD CONSTRAINT `accountlines_check_type` CHECK (accounttype IS NOT NULL OR debit_type_code IS NOT NULL)
19901
        }
19902
    );
19903
19904
    # Populating debit_type_code
19897
    # Populating debit_type_code
19905
    $dbh->do(
19898
    $dbh->do(
19906
        qq{
19899
        qq{
Lines 20010-20044 if ( CheckVersion($DBversion) ) { Link Here
20010
        );
20003
        );
20011
    }
20004
    }
20012
20005
20013
    # Dropping the check constraint in accountlines
20014
    my ($raise_error) = $dbh->{RaiseError};
20015
    $dbh->{AutoCommit} = 0;
20016
    $dbh->{RaiseError} = 1;
20017
    eval {
20018
        # MariaDB Specific Drop
20019
        $dbh->do(
20020
          qq{
20021
            ALTER TABLE
20022
              accountlines
20023
            DROP CONSTRAINT
20024
              `accountlines_check_type`
20025
          }
20026
        );
20027
    };
20028
    if ($@) {
20029
        # MySQL Specific Drop
20030
        $dbh->do(
20031
          qq{
20032
            ALTER TABLE
20033
              accountlines
20034
            DROP CHECK
20035
              `accountlines_check_type`
20036
          }
20037
        );
20038
    }
20039
    $dbh->{AutoCommit} = 1;
20040
    $dbh->{RaiseError} = $raise_error;
20041
20042
    # Update accountype 'C' to 'CREDIT'
20006
    # Update accountype 'C' to 'CREDIT'
20043
    $dbh->do(
20007
    $dbh->do(
20044
        qq{
20008
        qq{
Lines 20099-20115 if ( CheckVersion($DBversion) ) { Link Here
20099
        }
20063
        }
20100
    );
20064
    );
20101
20065
20102
    # Adding a check constraints to accountlines
20103
    $dbh->do(
20104
        qq{
20105
          ALTER TABLE
20106
            accountlines 
20107
          ADD CONSTRAINT 
20108
            `accountlines_check_type`
20109
          CHECK (credit_type_code IS NOT NULL OR debit_type_code IS NOT NULL)
20110
        }
20111
    );
20112
20113
    # Drop accounttype field
20066
    # Drop accounttype field
20114
    $dbh->do(
20067
    $dbh->do(
20115
        qq{
20068
        qq{
20116
- 

Return to bug 23673