Answers.Body: <p>As of CiviCRM 4.7, you can fix this by installing any extension; see <a href="https://issues.civicrm.org/jira/browse/CRM-15078" rel="nofollow">CRM-15078</a>.  Schema differences are fixed on extension installation.</p>
  
  <p>If you are on an earlier version of CiviCRM, there's a trick you can do.  Edit the PHP for a page that doesn't normally get used - I like the API Explorer page (CRM/Admin/Page/APIExplorer.php).</p>
  
  <p>Right after <code>public function run() {</code>, I put:</p>
  
  <pre><code>$temp = new CRM_Logging_Schema();
  $temp-&gt;fixSchemaDifferences(TRUE);
  echo "Binary log schema differences are now fixed.";
  die;
  </code></pre>
  
  <p>Once I get back the "now fixed" message, I remove the code from the page and everything works.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-08T14:28:52.013Z
Answers.Text: I was the one who fixed that bug at the sprint, it happened to be something I had already encountered. In one of my extensions that creates a custom entity type, I put the fixSchemaDifferences stuff in the extension's hook_civicrm_enable instance, so the extension works on older versions with logging too.
Answers.UserDisplayName: DaveFF
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-02-27T21:20:07.763Z
Answers.Text: Thanks, this is still a relevant solution 4 years later.
Answers.UserDisplayName: Iowa Boy
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-01-08T13:36:29.777Z
Answers.LastActivityDate: 2016-01-08T13:36:29.777Z
Answers.UserDisplayName: Jon G - Megaphone Tech
Body: <p>Sometimes I install an extension that creates a new MySQL table, but it breaks because I have binary ("advanced") logging enabled. CiviCRM tries to write to the binary log, and it fails because the table doesn't exist.</p>
  
  <p>Other times, there's a corrupt binary log table, which I can only fix by dropping it.</p>
  
  <p>In these situations, I know that disabling and re-enabling binary logging will fix the situation, but then I lose my existing logs!  Is there another less destructive solution?</p>
  
Tags: <developer><logging>
Title: How can I deal with a missing or corrupt binary ("advanced") log table?
ThreadText: # How can I deal with a missing or corrupt binary ("advanced") log table?
  
  (Asked by: username_0 on 2016-01-08)
  
  Sometimes I install an extension that creates a new MySQL table, but it breaks because I have binary ("advanced") logging enabled. CiviCRM tries to write to the binary log, and it fails because the table doesn't exist.
  
  Other times, there's a corrupt binary log table, which I can only fix by dropping it.
  
  In these situations, I know that disabling and re-enabling binary logging will fix the situation, but then I lose my existing logs! Is there another less destructive solution?
  
  **Tags:** developer, logging
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2016-01-08. Score: 4
  
  As of CiviCRM 4.7, you can fix this by installing any extension; see CRM-15078.  Schema differences are fixed on extension installation.
  If you are on an earlier version of CiviCRM, there's a trick you can do.  Edit the PHP for a page that doesn't normally get used - I like the API Explorer page (CRM/Admin/Page/APIExplorer.php).
  Right after public function run() {, I put:
  $temp = new CRM_Logging_Schema();
  $temp->fixSchemaDifferences(TRUE);
  echo "Binary log schema differences are now fixed.";
  die;
  
  Once I get back the "now fixed" message, I remove the code from the page and everything works.
  
  > **Comments:**
  > **username_1**: I was the one who fixed that bug at the sprint, it happened to be something I had already encountered. In one of my extensions that creates a custom entity type, I put the fixSchemaDifferences stuff in the extension's hook_civicrm_enable instance, so the extension works on older versions with logging too.  
  > **username_2**: Thanks, this is still a relevant solution 4 years later.  
  
  ---
  
  