Answers.Body: <p>That would be nice, but I am afraid it is not there (yet). When you lookup the <a href="https://github.com/civicrm/cv/tree/master/src/Command" rel="nofollow noreferrer">list of cv commands</a> in de source on GitHub, you will not find this command.</p>
  
  <p>However, using the <code>drush</code> <a href="https://github.com/civicrm/civicrm-drupal/blob/7.x-master/drush/civicrm.drush.inc" rel="nofollow noreferrer">source code</a> as inspiration you can create a small script </p>
  
  <pre><code>&lt;?php
    $codeVer = CRM_Utils_System::version();
    $dbVer = CRM_Core_BAO_Domain::version();
    if (version_compare($codeVer, $dbVer) == 0) {
       echo "You are already upgraded to CiviCRM $codeVer \n";
    } else {
       $upgradeHeadless = new CRM_Upgrade_Headless();
       $result = $upgradeHeadless-&gt;run();
       echo "Upgrade outputs:\n" . $result['text'] . "\n";
    }
  </code></pre>
  
  <p>And run it with the <code>cv scr &lt;script.php&gt;</code></p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-05-11T08:32:46.650Z
Answers.LastActivityDate: 2017-05-11T08:32:46.650Z
Answers.UserDisplayName: Kainuk - CiviCooP
Answers.Body: <p>The <code>cv upgrade:db</code> command from <a href="https://github.com/civicrm/cv/pull/2" rel="nofollow noreferrer">https://github.com/civicrm/cv/pull/2</a> was recently merged for v0.2.3. This revision hasn't been broadly deployed or tested yet, but it provides a richer upgrade experience:</p>
  
  <ul>
  <li>By default, there's a progress indicator.</li>
  <li>With <code>-vvv</code>, you can get a detailed report/log of the upgrade steps as they execute.</li>
  <li>With <code>-vvv --dry-run</code>, you can see a detailed preview of the upgrade steps.</li>
  <li>With <code>--retry</code> or <code>--skip</code>, you can resume after an upgrade failure.</li>
  <li>With <code>--quiet</code>, you can limit output to particularly interesting information.</li>
  </ul>
  
  <p>I've found that <code>-vvv</code> and <code>--dry-run</code> are helpful when developing patches for the <code>civicrm-core</code> upgrade logic, and they may also be helpful with large or temperamental upgrades.</p>
  
  <p>(<strong>Note</strong>: PR #2 also anticipates several more subcommands for identifying/downloading upgrades and for reporting successes and failures. However, these are not live at time of writing)</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-03-01T01:47:21.797Z
Answers.LastActivityDate: 2018-03-01T01:47:21.797Z
Answers.UserDisplayName: Tim Otten
Body: <p>I'd like to run the database upgrades from the command line. I know I can do with with <code>drush civicrm-upgrade-db</code> but I'd like to know a way to do it in a CMS-agnostic way (that will work for Wordpress and Joomla).</p>
  
  <p>I see there is <code>cv ext:upgrade-db</code> which claims to "Apply DB upgrades for any extensions". Is there a corresponding <code>cv</code> command for CiviCRM core?</p>
  
Tags: <upgrade><drush><cv>
Title: How do I use cv to run database upgrades from the command line?
ThreadText: # How do I use cv to run database upgrades from the command line?
  
  (Asked by: username_0 on 2017-05-11)
  
  I'd like to run the database upgrades from the command line. I know I can do with with `drush civicrm-upgrade-db` but I'd like to know a way to do it in a CMS-agnostic way (that will work for Wordpress and Joomla).
  
  I see there is `cv ext:upgrade-db` which claims to "Apply DB upgrades for any extensions". Is there a corresponding `cv` command for CiviCRM core?
  
  **Tags:** upgrade, drush, cv
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2018-03-01. Score: 4 | Accepted answer
  
  The `cv upgrade:db` command from <https://github.com/civicrm/cv/pull/2> was recently merged for v0.2.3. This revision hasn't been broadly deployed or tested yet, but it provides a richer upgrade experience:
  
  * By default, there's a progress indicator.
  * With `-vvv`, you can get a detailed report/log of the upgrade steps as they execute.
  * With `-vvv --dry-run`, you can see a detailed preview of the upgrade steps.
  * With `--retry` or `--skip`, you can resume after an upgrade failure.
  * With `--quiet`, you can limit output to particularly interesting information.
  
  I've found that `-vvv` and `--dry-run` are helpful when developing patches for the `civicrm-core` upgrade logic, and they may also be helpful with large or temperamental upgrades.
  
  (**Note**: PR #2 also anticipates several more subcommands for identifying/downloading upgrades and for reporting successes and failures. However, these are not live at time of writing)
  
  
  ---
  
  ### Answer by username_1 on 2017-05-11. Score: 2
  
  That would be nice, but I am afraid it is not there (yet). When you lookup the [list of cv commands](https://github.com/civicrm/cv/tree/master/src/Command) in de source on GitHub, you will not find this command.
  
  However, using the `drush` [source code](https://github.com/civicrm/civicrm-drupal/blob/7.x-master/drush/civicrm.drush.inc) as inspiration you can create a small script
  
  ```
  <?php
    $codeVer = CRM_Utils_System::version();
    $dbVer = CRM_Core_BAO_Domain::version();
    if (version_compare($codeVer, $dbVer) == 0) {
       echo "You are already upgraded to CiviCRM $codeVer \n";
    } else {
       $upgradeHeadless = new CRM_Upgrade_Headless();
       $result = $upgradeHeadless->run();
       echo "Upgrade outputs:\n" . $result['text'] . "\n";
    }
  
  ```
  
  And run it with the `cv scr <script.php>`
  
  
  ---
  
  