Upon updating to Linkit 7.x-3.3 I'm getting this FAIL:

The following updates returned messages

linkit module

Update #7302
Failed: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'role_rids' in 'field list': UPDATE {linkit_profiles} SET name=:db_update_placeholder_0, admin_title=:db_update_placeholder_1, data=:db_update_placeholder_2, role_rids=:db_update_placeholder_3, weight=:db_update_placeholder_4 WHERE (pid = :db_condition_placeholder_0) ; Array ( [:db_update_placeholder_0] => basic [:db_update_placeholder_1] => Basic [:db_update_placeholder_2] => a:10:{s:11:"entity:node";a:4:{s:18:"result_description";s:156:"[node:field_image] [node:title] | [node:content-type] | [node:url]";s:7:"bundles";a:6:{s:7:"article";i:0;s:4:"page";i:0;s:4:"book";i:0;s:5:"panel";i:0;s:4:"poll";i:0;s:7:"webform";i:0;}s:15:"group_by_bundle";i:0;s:19:"include_unpublished";i:0;}s:11:"entity:file";s:6:"entity";s:20:"entity:taxonomy_term";a:3:{s:18:"result_description";s:0:"";s:7:"bundles";a:2:{s:4:"tags";i:0;s:6:"forums";i:0;}s:15:"group_by_bundle";i:0;}s:11:"entity:user";a:1:{s:18:"result_description";s:0:"";}s:4:"imce";a:1:{s:8:"use_imce";i:0;}s:12:"autocomplete";a:3:{s:9:"charLimit";i:3;s:4:"wait";i:350;s:13:"remoteTimeout";i:10000;}s:10:"attributes";a:5:{s:3:"rel";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}s:5:"class";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}s:9:"accesskey";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}s:2:"id";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}s:5:"title";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}}s:14:"search_plugins";a:6:{s:11:"entity:node";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:1;}s:17:"linkt_panel_pages";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:1;}s:11:"entity:file";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}s:11:"entity:user";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}s:20:"entity:taxonomy_term";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}s:12:"linkit_views";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}}s:17:"attribute_plugins";a:6:{s:3:"rel";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}s:5:"class";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}s:9:"accesskey";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}s:2:"id";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}s:5:"title";a:2:{s:6:"weight";s:1:"0";s:7:"enabled";i:0;}s:6:"target";a:2:{s:7:"enabled";i:0;s:6:"weight";i:-10;}}s:13:"insert_plugin";a:2:{s:6:"plugin";s:7:"raw_url";s:10:"url_method";i:1;}} [:db_update_placeholder_3] => N; [:db_update_placeholder_4] => 0 [:db_condition_placeholder_0] => 1 ) in drupal_write_record() (line 7239 of /.../includes/common.inc).

I'll try disabling, uninstalling and then re-enabling, but clearly something is wrong.

Comments

anon’s picture

Priority: Major » Normal

Upgrading from what version?

Is your prev linkit profiles exported in some way, like features or in code?

anon’s picture

also, uninstall linkt_panel_pages and linkit_views.

deanflory’s picture

I'm not sure what the previous version was. Not exported in features or code.

Reinstalled all linkit modules and submodules and don't seem to have the issue anymore.

anon’s picture

Status: Active » Closed (cannot reproduce)

I close this for now.

Feel free to open it again if someone else have this problem.

troybthompson’s picture

I got this error upgrading from 2.6. I didn't save a copy of the settings beforehand, but I have other sites to upgrade so I can do so if that helps. I typically just have one profile setup for LinkIt.

mstrelan’s picture

Status: Closed (cannot reproduce) » Active
StatusFileSize
new2.67 KB
new2.85 KB

I experienced this issue upgrading from 7.x-2.5 to 7.x-3.3. LinkIt profile export attached. This was stored in a features module. I updated the export to the new format and running the update works this time. Had to "revert" the profile to the new code version after running update.php.

radimklaska’s picture

Same here during 7.x-2.5 to 7.x-3.3 update. Profile exported in features.
Looks like 7.x-2.5 to 7.x-3.2 works fine.

eelkeblok’s picture

Status: Active » Needs review
StatusFileSize
new449 bytes

I experienced this problem as well. It seems to have to do with the old schema that is still cached when update 7302 does its thing. Something somewhere calls drupal_write_record() (mentioned in the error message). That function uses drupal_get_schema() to get the database schema and figure out which columns are valid for a given database table. The schema still has the definition for the role_rids column, which causes drupal_write_record() to produce an invalid query and subsequently causing the error. (This is all speculation based on that I saw drupal_write_record mentioned in the error message).

This probably only happens when you run update 7300 (which removes the column) and 7302 in one sitting. FWIW, if you run into this problem, just rerunning update.php should work (it seems to have done for me), because at the end of update.php, caches are cleared, so the schema gets reloaded. Running update 7302 then should go fine.

The attached patch forces the schema to rebuild right after the database changes were done in update 7300. I ran things on our testing environment with the patch applied and I did not get the error.

Note that if you did get this error, applying this patch and rerunning the update on the same environment does not constitute a valid test of this patch. You will need an environment that has not been updated from 2.x to 3.x yet (or more specifically, that has not had linkit_update_7300() ran yet) to be able to test this patch.

Status: Needs review » Needs work

The last submitted patch, 8: linkit-cached-schema-update-2405093-8.patch, failed testing.

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, 8: linkit-cached-schema-update-2405093-8.patch, failed testing.

eelkeblok’s picture

I'm thinking the failing test has nothing to do with this patch, but I might be wrong. Could anyone more at home in this module's code (and tests) have a look?

eelkeblok’s picture

Status: Needs work » Needs review
Related issues: +#2443487: Tests are failing for 3.x on d.o

The tests are failing due to #2443487. I'm setting this to "Needs review".

eelkeblok’s picture

Title: Update #7302 Failed: PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'role_rids' in 'field list' » Updating from 2.x to >=3.3 fails with PDOException
Priority: Normal » Major

I'm updating the issue title to more clearly describe the problem.

eelkeblok’s picture

Version: 7.x-3.3 » 7.x-3.x-dev

Setting to 3.x so we test against the branch that has the fix for #2443487.

cameron prince’s picture

I just ran into this trying to get linkit_views working. Re-running drush updb didn't resolve it. But once linkit_views was disabled the update applied.

eelkeblok’s picture

gaxze’s picture

patch #8 works for me.

  • anon committed 85f2f09 on 7.x-3.x authored by eelkeblok
    Issue #2405093 by eelkeblok: Updating from 2.x to >=3.3 fails with...
anon’s picture

Status: Needs review » Fixed

@eelkeblok: Thanks for the patch. I have committed this now.

Status: Fixed » Closed (fixed)

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