Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-19357

Add unique constraint on civicrm_entity_financial_account

    Details

    • Type: Improvement
    • Status: Done/Fixed
    • Priority: Trivial
    • Resolution: Fixed/Completed
    • Affects Version/s: 4.7
    • Fix Version/s: 4.7.19
    • Component/s: None
    • Labels:
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      There is no constraint on civicrm_entity_financial_account to ensure that there is only a single unique value for its natural key. If there are duplicates, then which of the non-unique values is returned is non-determinate, and accounting becomes indeterminate...ie BAD things happen.

      On upgrade, run the following:

      ALTER TABLE civicrm_entity_financial_account ADD CONSTRAINT civicrm_entity_financial_account_natural_key UNIQUE (entity_table, entity_id, account_relationship);

      Modify https://github.com/civicrm/civicrm-core/blob/master/xml/schema/Financial/EntityFinancialAccount.xml to add this index to tarball.

        Attachments

          Activity

            People

            • Assignee:
              monish.deb Monish Deb
              Reporter:
              joemurray Joe Murray
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: