<p>Ok, after a lot of trial and error I've finally managed to get this site upgraded. Here's a rough outline of the process and what the problem turned out to be:</p>

<ul>
<li>First, I tried updating one minor version at a time. This led me to find that the problem seemed to be with updating from the last build of 2.4 to the first build of 2.5</li>
<li>The error message on update wasn't super helpful ("There was a problem updating your database"), but by trawling through Craft's log file (<code>craft/storage/runtime/logs/craft.log</code>) I found that the update seemed to be failing when trying to create the table <code>elementindexsettings</code> because (for whatever reason) that table already existed (resulting in the error <em>Failed to apply migration: m150827_000000_element_index_settings</em>).</li>
<li>I can't think why this would be the case, since after each failed update attempt I fully restored my previous database, but since my <code>elementindexsettings</code> table was empty, I dropped it and tried the update again. At this point it worked.</li>
</ul>

<p>So in summary, the solution was:</p>

<ol>
<li>Update to Craft 2.4.2726 (and commit this to version control!)</li>
<li>Attempt a manual update to Craft 2.5.2750. When this fails, drop the <code>elementindexsettings</code> table and try running the update again (ie. go to <code>/admin</code> and press the "Finish up" button.</li>
<li>Update to the latest version.</li>
</ol>

<p>As a side note, I found setting Craft's <a href="https://craftcms.com/docs/config-settings#backupDbOnUpdate" rel="nofollow"><code>backupDbOnUpdate</code></a> config setting to <code>false</code> made the update process much faster and less painful when having to do a lot of attempted updates followed by rollbacks (though obviously if doing this be careful to make sure you have a backup you can restore if the process goes wrong).</p>

CC BY-SA 3.0
2016-06-29T17:46:50.533Z
If anyone from Pixel & Tonic is reading, I suspect you might be able to make the upgrade process from 2.4 to 2.5 smooth just by adding an "IF NOT EXISTS" clause to the migration in question.
Nick F
CC BY-SA 3.0
2016-06-29T16:58:42.260Z
2016-06-29T16:58:42.260Z
Nick F
<p>It should just work - but I've had a few instances where the automatic one wouldn't work and had to go manual.</p>

<p>We had one which simply wouldn't work at all - that was a 2.2 to 2.6 upgrade, and it failed when trying to do the database every single time. We rebuilt it from scratch.</p>

<p>More info on exactly how it's breaking for you would help.</p>

CC BY-SA 3.0
2016-06-29T11:22:05.037Z
Ah, that doesn't bode well! We definitely can't rebuild this one from scratch... The particular issue (the immediate issue, at any rate) seems to be that at a certain point the "status" field disappeared from the users table. I've tried recreating it, but then I just run into "an error" (which looks like it might just be a memory limit problem... am looking into that now). Did you try the option of stepped updates at all? (eg. 2.2 --> 2.3, 2.3 --> 2.4, etc)
Nick F
CC BY-SA 3.0
2016-06-29T17:40:25.673Z
Just in case you ever need to do this again, I finally managed to get the upgrade to work... See my answer above for the details.
Nick F
CC BY-SA 3.0
2016-06-30T08:17:02.307Z
Great, thanks! That is indeed the error that had us totally stuck.
Matt Wilcox
CC BY-SA 3.0
2016-06-29T11:02:06.380Z
2016-06-29T11:02:06.380Z
Matt Wilcox
<p>I'm trying to update an old site that is still running on Craft 2.2 (from September 2014), but unfortunately the update process to the current version (2.6) breaks.</p>

<p>Does anyone have any experience of upgrading a Craft site from several versions back? I'm thinking my best bet might be to try doing it in a series of steps by downloading intermediate versions from <a href="https://craftcms.com/support/download-previous-versions" rel="nofollow">here</a>. I'm wondering though if there are particular version numbers that are good milestones for updating (or best avoided)? (I half remember a version that had to be manually installed a while back) Or alternatively, whether there's a better approach I haven't thought of?</p>

<p><strong>Update:</strong> the problematic step seems to be upgrading to 2.5. I've managed to run updates up to the last build of 2.4 but the jump from 2.4 to 2.5 always seems to fail. The error message is just "There was a problem updating your database", so it's hard to know what exactly is going wrong.</p>

CC BY-SA 3.0
2016-06-29T10:14:27.350Z
Did you try manually updating to the latest version?
carlcs
CC BY-SA 3.0
2016-06-29T10:15:11.063Z
Yes. I've tried both manually updating and auto-updating. Both times the update ran into the same problem.
Nick F
CC BY-SA 3.0
2016-06-29T16:54:28.763Z
When something goes wrong with an installation, check your Craft.log.  Everything gets logged and  you should be able to see what's being hung up. I've seen this before with plugins that didn't migrate properly, you may have to disable them first.
RitterKnight
CC BY-SA 3.0
2016-06-29T16:59:38.200Z
Ah, thanks. Yep, that's exactly what I did and it helped me finally get to the bottom of the issue (see my answer below for what ended up working)
Nick F
<updating>
How to update from a very old version of Craft?
# How to update from a very old version of Craft?

(Asked by: username_0 on 2016-06-29)

I'm trying to update an old site that is still running on Craft 2.2 (from September 2014), but unfortunately the update process to the current version (2.6) breaks.

Does anyone have any experience of upgrading a Craft site from several versions back? I'm thinking my best bet might be to try doing it in a series of steps by downloading intermediate versions from [here](https://craftcms.com/support/download-previous-versions). I'm wondering though if there are particular version numbers that are good milestones for updating (or best avoided)? (I half remember a version that had to be manually installed a while back) Or alternatively, whether there's a better approach I haven't thought of?

**Update:** the problematic step seems to be upgrading to 2.5. I've managed to run updates up to the last build of 2.4 but the jump from 2.4 to 2.5 always seems to fail. The error message is just "There was a problem updating your database", so it's hard to know what exactly is going wrong.

**Tags:** updating

> **Comments:**
> **username_1**: Did you try manually updating to the latest version?  
> **username_0**: Yes. I've tried both manually updating and auto-updating. Both times the update ran into the same problem.  
> **username_2**: When something goes wrong with an installation, check your Craft.log.  Everything gets logged and  you should be able to see what's being hung up. I've seen this before with plugins that didn't migrate properly, you may have to disable them first.  
> **username_0**: Ah, thanks. Yep, that's exactly what I did and it helped me finally get to the bottom of the issue (see my answer below for what ended up working)  

---

## 2 answers

### Answer by username_0 on 2016-06-29. Score: 4 | Accepted answer

Ok, after a lot of trial and error I've finally managed to get this site upgraded. Here's a rough outline of the process and what the problem turned out to be:

* First, I tried updating one minor version at a time. This led me to find that the problem seemed to be with updating from the last build of 2.4 to the first build of 2.5
* The error message on update wasn't super helpful ("There was a problem updating your database"), but by trawling through Craft's log file (`craft/storage/runtime/logs/craft.log`) I found that the update seemed to be failing when trying to create the table `elementindexsettings` because (for whatever reason) that table already existed (resulting in the error *Failed to apply migration: m150827\_000000\_element\_index\_settings*).
* I can't think why this would be the case, since after each failed update attempt I fully restored my previous database, but since my `elementindexsettings` table was empty, I dropped it and tried the update again. At this point it worked.

So in summary, the solution was:

1. Update to Craft 2.4.2726 (and commit this to version control!)
2. Attempt a manual update to Craft 2.5.2750. When this fails, drop the `elementindexsettings` table and try running the update again (ie. go to `/admin` and press the "Finish up" button.
3. Update to the latest version.

As a side note, I found setting Craft's [`backupDbOnUpdate`](https://craftcms.com/docs/config-settings#backupDbOnUpdate) config setting to `false` made the update process much faster and less painful when having to do a lot of attempted updates followed by rollbacks (though obviously if doing this be careful to make sure you have a backup you can restore if the process goes wrong).

> **Comments:**
> **username_0**: If anyone from Pixel & Tonic is reading, I suspect you might be able to make the upgrade process from 2.4 to 2.5 smooth just by adding an "IF NOT EXISTS" clause to the migration in question.  

---

### Answer by username_3 on 2016-06-29. Score: 1

It should just work - but I've had a few instances where the automatic one wouldn't work and had to go manual.

We had one which simply wouldn't work at all - that was a 2.2 to 2.6 upgrade, and it failed when trying to do the database every single time. We rebuilt it from scratch.

More info on exactly how it's breaking for you would help.

> **Comments:**
> **username_0**: Ah, that doesn't bode well! We definitely can't rebuild this one from scratch... The particular issue (the immediate issue, at any rate) seems to be that at a certain point the "status" field disappeared from the users table. I've tried recreating it, but then I just run into "an error" (which looks like it might just be a memory limit problem... am looking into that now). Did you try the option of stepped updates at all? (eg. 2.2 --> 2.3, 2.3 --> 2.4, etc)  
> **username_0**: Just in case you ever need to do this again, I finally managed to get the upgrade to work... See my answer above for the details.  
> **username_3**: Great, thanks! That is indeed the error that had us totally stuck.  

---

