3

A while back I did

$ civibuild create demo.local --type drupal-demo --url http://demo.local

and got a working local site running CiviCRM 4.7.9. Great.


Now I'd like to upgrade this site to 4.7.17.

I tried:

$ cd ~/buildkit/build/demo.local/sites/all/modules/civicrm
$ git fetch
$ git checkout 4.7.17
$ cv flush
$ drush civicrm-upgrade-db

The last command gives You are already upgraded to CiviCRM 4.7.9.

What did I miss?

EDIT:

Also I have tried:

$ git checkout master
$ git pull

as well as browsing to http://demo.local/civicrm/upgrade?reset=1 to perform the database upgrades (Which tells me "Your database has already been upgraded to CiviCRM 4.7.9")

3 Answers 3

5

tldr

cd buildkit/build/dmaster/sites/all/modules/civicrm

## Ensure that all your stuff is clean/committed.
git scan status

## Update git repos. Choose ONE of:
git scan up
./bin/givi checkout X.Y.Z

## Regenerate data. Choose ONE of:
civibuild reinstall dmaster
./bin/setup.sh -Dg && drush civicrm-upgrade-db

Checking the git repos

There are multiple git repos in your build (civicrm-core.git, civicrm-packages.git, etal). Before making a major switch, I first double-check that all of these repos are in sane condition -- ie there shouldn't be any uncommitted changes, the repos should be on normal branches, etc.

git scan status

Updating the git repos

As a developer who tracks mainline branches, my day-to-day interest is "updating to the latest revision of master or 4.6". The command git scan up will perform a standard "fast-forward merge" (git pull --ff-only) across all the repos:

git scan up 

(Tip: If you didn't cleanup earlier, then "fast-forward" may not be possible. It takes some judgment to decide what to do -- e.g. a "merge" versus "rebase". Rather than risk a wrong decision, git scan will skip these repos and display warnings instead.)

Your example uses a tag. Hopping among tags is a bit different than tracking a branch. For this, I use givi:

./bin/givi checkout 4.7.17

Updating the generated code, config files, databases

As a developer who does weird things on a day-to-day basis (like manually hacking SQL records to provoke weird situations), I have trouble remembering all the weird things that I've done before -- and honestly don't care about them afterward. I just want to get back to a consistent/clean state. Reinstalling is nice because it recreates/overwrites all generated-code, config-files, and database content.

civibuild reinstall dmaster

However, that does reset all the data. If you care about the content in the database, then don't do a reinstall. Instead, update the generated-code and perform a DB upgrade:

./bin/setup.sh -Dg
drush civicrm-upgrade-db

See also

For more discussion, see the blog post: https://civicrm.org/blogs/totten/developer-tip-managing-multiple-git-repositories

1
0

Firstly, I don't think that git checkout would overwrite files without doing a git pull, would it? Those files need to be overwritten with the new version.

The next thing is that you probably need to visit the upgrade URL:

http:///civicrm/upgrade?reset=1

Good luck!

1
  • That didn't do it for me. (Updated my question for clarification)
    – Sean
    Commented Mar 15, 2017 at 22:32
0

Second try: do a git checkout -f

To force overwrite of local files!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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