3

If a CiviCRM upgrade amends the structure of existing tables, do you know if the same changes are applied to the equivalent logging tables?

I've noticed in the column civicrm_line_item.label NULL is allowed, but in log_civicrm_line_item.label it's not. So when I create Contribution prices without labels, I get a constraint violation from the logging trigger during payment.

Wanted to check if it's safe to amend the logging table structure to match, or if there was a reason for the difference.

1

It should change the structure on the log tables, but with the caveat that the log table system isn't at the same level of support and usage as the rest of CiviCRM. The beta label hasn't come off it for years, so I wouldn't be surprised to see a bug like that.

If you're using logging, I assume you're already prepared for trouble when you upgrade, and if you are capable of changing the field structure now, I assume you'll be able to fix things later. Consequently, go ahead and make the change, but note it somewhere. If an upgrade fails, you'll know one potential reason.

2

See Are the logging tables upgraded:

yes. you disable logging during upgrade (the upgrade changes are not logged)

when u reenable logging, it checks for schema differences and makes the needed changes to the logging table

Since version 4.3, logging should be automatically disabled and re-enabled during upgrades: see Upgrade should disable logging and triggers.

This suggests the possibility that if logging remained enabled during an upgrade prior to 4.3.0, the structure of logging tables may not have been updated at that point.

It also suggests that disabling and re-enabling logging ought to bring the logging schema up to date.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.