Answers.Body: <p>Your database is running on CiviCRM 5.22.0. scheme
  Your plugin in /sites/all/modules/civicrm is CiviCRM v5.20.2
  You need to download and follow upgrading docs from Civicrm to upgrade your plugin folder to CiviCRM 5.22.0 or above, then do the database upgrade to make Civicrm plugin and the running database scheme run on the same version.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-08T13:29:10.633Z
Answers.Text: This is crazy: I didn't upgrade anything between the backup and the restore operation. Is it possible that the error was already present before the backup/restore operation without showing up, due to a failed attempt to upgrade a week ago?
Answers.UserDisplayName: Pierre François
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-08T09:28:22.323Z
Answers.LastActivityDate: 2020-06-08T09:28:22.323Z
Answers.UserDisplayName: user8057
Answers.Body: <p>It means the CiviCRM database and code are at different versions - but you say that you copied both site &amp; DB, so unless the process failed somewhere you should have the same code and DB as your original site.</p>
  
  <p>Was your backup site empty or did have a previous install of CiviCRM?</p>
  
  <p>Your comment above "Is it possible that the error was already present before the backup/restore operation without showing up, due to a failed attempt to upgrade a week ago?".  That doesn't fully explain it since you would upgrade the files first and then run the db updates, so when it fails the files version is <em>newer</em> than the db version and you are reporting the other way round.  But if you upgraded then reverted the files, that would explain it.</p>
  
  <p>Much depends on why the upgrade failed and what you did after that. If you missed schema updates despite it reporting 5.22.0 then you could hit problems later. For a test/dev box, upgrading to 5.26.0 should be ok.  For a production box, I'd check further but that depends on the details of the failure and the subsequent actions.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-06-08T15:57:58.427Z
Answers.LastActivityDate: 2020-06-08T15:57:58.427Z
Answers.UserDisplayName: Aidan
Body: <p>I am starting to use CiviCRM under Drupal 7 and feel myself still as a newbie.</p>
  
  <p>I made a backup with the Backup and Migrate module of Drupal (site + DB). As a good practice, I tried immediately after the backup to restore the backup, just to learn how to do in case of trouble.</p>
  
  <p>I better did not because I got the error message: </p>
  
  <pre><code>Your database is marked with an unexpected version number: 5.22.0. 
  The v5.20.2 codebase may not be compatible with your database state.
  You will need to determine the correct version corresponding to your current database state. 
  You may want to revert to the codebase you were using until you resolve this problem.
  </code></pre>
  
  <p>The menus of CiviCRM are now at the bottom of the screen with an ugly layout.</p>
  
  <p>So backing up and restoring with the module Backup and Migrate seems to be a perfect instrument of (hopefully partial) self-destruction of Drupal or CiviCRM. </p>
  
  <p>I have no idea on how to "revert to the codebase you were using until you resolve this problem". Any help will be appreciated.</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-08T11:59:36.900Z
Comments.Text: your database version is higher than code base, you need to update your code base version to 5.22.0
Comments.UserDisplayName: Sunil Pawar
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2020-06-08T14:38:58.937Z
Comments.Text: I fixed this issue by upgrading CiviCRM to 5.26.0.
Comments.UserDisplayName: Pierre François
Tags: <drupal><backups>
Title: How to fix "Database In Unexpected Version"
ThreadText: # How to fix "Database In Unexpected Version"
  
  (Asked by: username_0 on 2020-06-05)
  
  I am starting to use CiviCRM under Drupal 7 and feel myself still as a newbie.
  
  I made a backup with the Backup and Migrate module of Drupal (site + DB). As a good practice, I tried immediately after the backup to restore the backup, just to learn how to do in case of trouble.
  
  I better did not because I got the error message:
  
  ```
  Your database is marked with an unexpected version number: 5.22.0. 
  The v5.20.2 codebase may not be compatible with your database state.
  You will need to determine the correct version corresponding to your current database state. 
  You may want to revert to the codebase you were using until you resolve this problem.
  
  ```
  
  The menus of CiviCRM are now at the bottom of the screen with an ugly layout.
  
  So backing up and restoring with the module Backup and Migrate seems to be a perfect instrument of (hopefully partial) self-destruction of Drupal or CiviCRM.
  
  I have no idea on how to "revert to the codebase you were using until you resolve this problem". Any help will be appreciated.
  
  **Tags:** drupal, backups
  
  > **Comments:**
  > **username_1**: your database version is higher than code base, you need to update your code base version to 5.22.0  
  > **username_0**: I fixed this issue by upgrading CiviCRM to 5.26.0.  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2020-06-08. Score: 1 | Accepted answer
  
  Your database is running on CiviCRM 5.22.0. scheme
  Your plugin in /sites/all/modules/civicrm is CiviCRM v5.20.2
  You need to download and follow upgrading docs from Civicrm to upgrade your plugin folder to CiviCRM 5.22.0 or above, then do the database upgrade to make Civicrm plugin and the running database scheme run on the same version.
  
  > **Comments:**
  > **username_0**: This is crazy: I didn't upgrade anything between the backup and the restore operation. Is it possible that the error was already present before the backup/restore operation without showing up, due to a failed attempt to upgrade a week ago?  
  
  ---
  
  ### Answer by username_3 on 2020-06-08. Score: 0
  
  It means the CiviCRM database and code are at different versions - but you say that you copied both site & DB, so unless the process failed somewhere you should have the same code and DB as your original site.
  
  Was your backup site empty or did have a previous install of CiviCRM?
  
  Your comment above "Is it possible that the error was already present before the backup/restore operation without showing up, due to a failed attempt to upgrade a week ago?". That doesn't fully explain it since you would upgrade the files first and then run the db updates, so when it fails the files version is *newer* than the db version and you are reporting the other way round. But if you upgraded then reverted the files, that would explain it.
  
  Much depends on why the upgrade failed and what you did after that. If you missed schema updates despite it reporting 5.22.0 then you could hit problems later. For a test/dev box, upgrading to 5.26.0 should be ok. For a production box, I'd check further but that depends on the details of the failure and the subsequent actions.
  
  
  ---
  
  