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

(-)a/installer/data/mysql/updatedatabase.pl (-6 / +20 lines)
Lines 20015-20023 if ( CheckVersion($DBversion) ) { Link Here
20015
        qq{
20015
        qq{
20016
          ALTER TABLE
20016
          ALTER TABLE
20017
            accountlines
20017
            accountlines
20018
          ADD CONSTRAINT
20018
          DROP CHECK
20019
            `accountlines_check_type`
20019
            `accountlines_check_type`
20020
          CHECK (credit_type_code IS NOT NULL OR debit_type_code IS NOT NULL)
20021
        }
20020
        }
20022
    );
20021
    );
20023
20022
Lines 20073-20091 if ( CheckVersion($DBversion) ) { Link Here
20073
    # Populating credit_type_code
20072
    # Populating credit_type_code
20074
    $dbh->do(
20073
    $dbh->do(
20075
        qq{
20074
        qq{
20076
        UPDATE accountlines SET credit_type_code = accounttype, accounttype = NULL WHERE accounttype IN (SELECT code from account_credit_types)
20075
          UPDATE
20076
            accountlines 
20077
          SET
20078
            credit_type_code = accounttype, accounttype = NULL
20079
          WHERE accounttype IN (SELECT code from account_credit_types)
20077
        }
20080
        }
20078
    );
20081
    );
20079
20082
20080
    # Adding a check constraints to accountlines
20083
    # Adding a check constraints to accountlines
20081
    $dbh->do(
20084
    $dbh->do(
20082
        qq{
20085
        qq{
20083
        ALTER TABLE accountlines ADD CONSTRAINT `accountlines_check_type` CHECK (accounttype IS NOT NULL OR credit_type_code IS NOT NULL)
20086
          ALTER TABLE
20087
            accountlines 
20088
          ADD CONSTRAINT 
20089
            `accountlines_check_type`
20090
          CHECK (credit_type_code IS NOT NULL OR debit_type_code IS NOT NULL)
20091
        }
20092
    );
20093
20094
    # Drop accounttype field
20095
    $dbh->do(
20096
        qq{
20097
          ALTER TABLE accountlines
20098
          DROP COLUMN `accounttype`
20084
        }
20099
        }
20085
    );
20100
    );
20086
20101
20087
    SetVersion($DBversion);
20102
    SetVersion($DBversion);
20088
    print "Upgrade to $DBversion done (Bug 23049 - Add account credit_types)\n";
20103
    print "Upgrade to $DBversion done (Bug 23805 - Add account credit_types)\n";
20089
}
20104
}
20090
20105
20091
# SEE bug 13068
20106
# SEE bug 13068
20092
- 

Return to bug 23805