Hi,

I just wanted to upgrade from D6 version to D7 and wondered as I got an error message. I found out that in D7 a new column is added to the blockcache_alter table (bid) but which was not respected when I upgraded.

Best,
Tobias

Comments

fabianx’s picture

Title: No upgrade path from D5 to D7 version » No upgrade path from D6 to D7 version

Clarifying title ...

iamEAP’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new2.61 KB

Ran into this months ago when initially upgrading from D6 to D7 and decided it wasn't a priority (so we just left it disabled). Finally found a need for block cache alter, and here I am.

Here's a patch that adds an update hook for D6->D7 upgrades. The basic logic:

  1. Checks if the bid column already exists. If so, this is an existing D7 installation and we can ignore. Otherwise, continues:
  2. Adds the bid column to the DB and makes it primary key.
  3. Runs a query to determine block IDs for all existing block cache alter entries
  4. Truncates the block cache alter table
  5. Then inserts new records with valid block IDs from the query we ran previously

I also wrapped the hook_block_info_alter() DB query in a try/catch so that no errors are thrown between enabling the module and running the update hook.

fabianx’s picture

+++ b/blockcache_alter.install
@@ -46,4 +46,47 @@ function blockcache_alter_schema() {
+      foreach ($results as $bca) {
+        $insert->values($bca);
+      }

I am okay with that, but isn't a db_query() update query to populate bid simpler to write and read?

iamEAP’s picture

I believe you're only allowed to use db_query() for SELECT queries.

fabianx’s picture

Status: Needs review » Reviewed & tested by the community

**RTBM** - looks good to me.

fabianx’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed to 7.x-1.x. Thanks!

  • Fabianx committed 50e5765 on 7.x-1.x authored by iamEAP
    Issue #1932276 by iamEAP | tobiberlin: Fixed No upgrade path from D6 to...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.