Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I just updated OG from 7.x-2.0-beta2 to 7.x-2.3. After updating og_menu from 7.x-3.x-dev (datestamp 1347238034 2012-09-10) to 7.x-3.0-rc2, I'm unable to complete a DB update. The first time running drush updb
, I see:
The following updates are pending:
og_menu module :
7300 - Update og_menu schema to store group type and use etid instead of deprecated gid.
7301 - Enable OG Menu functionality for all group content types (backwards compatibility).
7302 - Enable OG Menu Default Links module if needed (backwards compatibility).
Do you wish to run all pending updates? (y/n): y
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'default.og' doesn't exist [error]
Performed update: og_menu_update_7300 [ok]
Finished performing updates. [ok]
Subsequent attempts yield:
Do you wish to run all pending updates? (y/n): y
Cannot add field <em class="placeholder">og_menu</em>.<em class="placeholder">group_type</em>: field already [error]
exists.
Performed update: og_menu_update_7300 [ok]
Finished performing updates. [ok]
I don't have the og
table in my DB and it's not in the og schema. (for either 7.x-2.0-beta2 or 7.x-2.3)
The `og` table was added in og_update_7000() for people upgrading from d6 but AFAICT not referenced after that. Still digging...
Comment | File | Size | Author |
---|---|---|---|
#29 | og_menu-hook_update_7300-2093511-29.patch | 3.12 KB | heddn |
#28 | og_menu-hook_update_7300-2093511-28.patch | 1.6 KB | heddn |
Comments
Comment #1
ezheidtmann CreditAttribution: ezheidtmann commentedIt appears that update 7300 is intended for poor souls who update from OG1 to OG2 and update from og_menu 2 to og_menu 3. That's not my case here, so I skipped the 7300 update with this SQL:
That eliminates the error message, but now the og_menu table is missing the group_type column. Ack.
Comment #2
ezheidtmann CreditAttribution: ezheidtmann commentedI've opted to not upgrade og_menu at this time, but I look forward to upgrading someday.
Comment #3
rv0 CreditAttribution: rv0 commentedtodo ;)
Comment #3.0
rv0 CreditAttribution: rv0 commentedUpdated issue summary.
Comment #4
troybthompson CreditAttribution: troybthompson commentedAny progress on this? I'm having the same problem. Is the table necessary or can I use the workaround above?
Comment #5
rv0 CreditAttribution: rv0 commentedSo basically this happens when updating from 6.x to 7.x-3.x ?
Comment #6
troybthompson CreditAttribution: troybthompson commentedI don't believe this particular site used OG Menu when it was in Drupal 6, but that was before my time. Is there a test I can do to help you find out?
Comment #7
rv0 CreditAttribution: rv0 commentedTell me exactly what you did, from which version you updated (and perhaps you have a backup of the code you updated from? if so, please share)
I know this issue isn't happening on fresh installs so all additional info is welcome. I did 2 upgrades from 7.x-2.x so far without issues, so I don't know where to start looking.
Comment #8
troybthompson CreditAttribution: troybthompson commentedI was originally using 7.x-3.x-dev (2012-Sep-09) and then did the system recommended upgrade to 7.x-3.0-rc3 and I got the series of errors above (how I found this thread). I also tried upgrading to the latest dev but had the same error. I'll try to get some database dumps if that will help.
Comment #9
rv0 CreditAttribution: rv0 commentedDon't think I'll need the db backup.. I'l gonna check the version you mention
Comment #10
rv0 CreditAttribution: rv0 commentedCould you guys try latest from git or wait for next dev reroll?
I added a simple check for the group_type
http://drupalcode.org/project/og_menu.git/blobdiff/2333b01faca2c2ae39cea...
Comment #11
ezheidtmann CreditAttribution: ezheidtmann commentedHey rv0 -- Unfortunately I don't have access to the original codebase or the current codebase (I'm off the project). But as I recall, this bug can be reproduced by doing an install of the 7.x-3.x branch before the update_7300 hook was added.
In other words, I believe this affects people who used the 7.x-3.x-dev before the 7300 update was written. Hope this helps.
-Evan
Comment #12
Corwin CreditAttribution: Corwin commentedI'm also having this issue
Comment #13
Corwin CreditAttribution: Corwin commenteddrush pml | grep og
...
Organic groups OG Menu (og_menu) Module Enabled 7.x-3.0-rc4
...
Organic groups Organic groups (og) Module Enabled 7.x-2.5
...
Even after applying the patch to og_menu.install I still get this:
Comment #14
iaminawe CreditAttribution: iaminawe commentedIt worked for me to comment out lines 94-157 in og_menu.install - run the update and then comment the lines back in.
All my group menus are restored correctly and the site I am working on is a D6 to D7 upgrade.
Comment #15
rv0 CreditAttribution: rv0 commented@iaminawe in #14
There is no D6 to D7 upgrade path as mentioned on the frontpage
#1538556: Upgrade path from Drupal 6
Comment #16
iaminawe CreditAttribution: iaminawe commentedI have it working properly in D7 and it came from a D6 site that I just upgraded using drush site upgrade and then OG & migrate module to get the groups migrated across.
In looking at the og_menu table from a fresh install of the module against what I currently had they were identical but the upgrade function in the lines above was doing some manipulation to the tables that didn't seem necessary judging by the structure I was looking at in the fresh install. I commented that function out, ran the remaining updates and commented it back in and ran update.php again this time with no errors
I should also mention I had all the menus in a feature too so not sure if that may have helped to keep their relationships intact but I now have each groups menu, from the D6 site showing correctly using the OG_menu block.
So not sure exactly what the magic combination there was but it worked for me and so I think an upgrade path does actually exist.
Comment #17
rv0 CreditAttribution: rv0 commentedwel in a way the D6 version is much easier to update to 7.x-3.x, this due to architecture of OG2.x branch
I do recommend running https://drupal.org/project/schema to verify your tables
Comment #18
iaminawe CreditAttribution: iaminawe commentedThanks for the advice, I have run the schema module and verified that the tables match the schema provided by the module.
Comment #19
rv0 CreditAttribution: rv0 commentedrc5 release has been tagged.
@Corwin still having this issue?
Comment #20
rv0 CreditAttribution: rv0 commentedComment #21
Corwin CreditAttribution: Corwin commentedThe issue with existing fields group_type and etid are because 7300 creates them but then errors trying to join to the nonexistent table og.
the check:
if (!db_field_exists('og_menu', 'group_type')) {
was added, but then it just fails on adding etid so I would recommend adding the same check for etid.
The original/source issue is:
SELECT og.gid, og.etid FROM {og} as og, {og_menu} as og_menu WHERE og.gid = og_menu.gid and og_menu.etid = 0 ORDER BY og_menu.gid
mysql> desc og_menu;
+------------+-------------+------+-----+---------+-------+
| Field | Type | Null | Key | Default | Extra |
+------------+-------------+------+-----+---------+-------+
| menu_name | varchar(32) | NO | PRI | | |
| gid | int(11) | NO | | NULL | |
| group_type | varchar(32) | NO | | | |
| etid | int(11) | NO | | NULL | |
+------------+-------------+------+-----+---------+-------+
4 rows in set (0.00 sec)
mysql> desc og;
ERROR 1146 (42S02): Table 'drupal_prod2.og' doesn't exist
Thank you for your help rv0. :)
Comment #22
Corwin CreditAttribution: Corwin commentedI am able to get the DB updates to work by changing '{og}' to 'og_membership'
Comment #23
Corwin CreditAttribution: Corwin commented7300 now completes, but corrupts the data.
Before og_menu updb:
SELECT * FROM og_menu WHERE menu_name="menu-main-menu";
+-----+----------------+
| gid | menu_name |
+-----+----------------+
| 2 | menu-main-menu |
+-----+----------------+
After og_menu updb:
SELECT * FROM og_menu WHERE menu_name="menu-main-menu";
+----------------+-----+------------+
| menu_name | gid | group_type |
+----------------+-----+------------+
| menu-main-menu | 281 | node |
+----------------+-----+------------+
Comment #24
Corwin CreditAttribution: Corwin commentedDoes anyone know how to translate/convert this mumbo-jumbo into SQL?
db_update('og_menu')
->expression('gid', 'etid')
->execute();
I guess the code here (og_module.install lines 139-160) is looking up the value to put into group_type so I'll replace it with some legible and functioning SQL. I don't see any way this code could be doing anything remotely useful but that's probably why it's corrupting the data.
Comment #25
rv0 CreditAttribution: rv0 commentedthat sounds really unhealthy
sorry about not having time to check this for you, soonest would be next week
Comment #26
rv0 CreditAttribution: rv0 commentedActually the code does exactly what the comments say.. First it creates a temporary etid column, later it replaces the gid column with values from the etid column
this is only relevant when updating from 7.x-2.x to 7.x-3.x
Comment #27
troybthompson CreditAttribution: troybthompson commentedI'm not technical enough to follow the end of this thread. Is there a workaround even if there's not a simple patch at this point?
Comment #28
heddnMy theory is that if the og table doesn't exist, then the migration from it isn't required. Here's a patch that does just that. Can I get a confirmation?
I'm not clear what the history of the site is through the various versions of og as this is a new site for me. But it came from og_menu 7.x-3.x-dev.
Comment #29
heddnI did some more digging into this and testing of the results of applying the patch in #2093511-29: og_menu_update_7300() fails when upgrading from 7.x-3.x-dev. It won't work. And it is ugly. This one works, is a little less ugly and seems to confirm my suspicion that migrating content the og table isn't necessary.
Comment #31
rv0 CreditAttribution: rv0 commentedThanks, hopefully this solves the updating issue for everyone.
Comment #33
troybthompson CreditAttribution: troybthompson commentedI successfully upgraded to the latest dev this time. Thanks!