Introduced in #2311957: Add weights to linkit profiles with commit:
http://cgit.drupalcode.org/linkit/commit/?h=7.x-3.x&id=542ad173c232b08d8...

Steps to reproduce:

  1. Install 7.x-2.7
  2. Have at least one Linkit profile.
  3. Update to latest 7.x-3.x-dev

SQLSTATE[42S22]: Column not found: 1054 Unknown column 'weight' in 'field list'

Comments

MiroslavBanov created an issue. See original summary.

ciss’s picture

Status: Needs work » Active
ciss’s picture

ciss’s picture

From what I'm glancing the best course of action would probably be to call 7305 at the beginning of 7303 and add a column check to 7305. Otherwise a lot of logic from linkit_profile_load_all() might have to be replicated.

miroslavbanov’s picture

Issue summary: View changes

Fixing steps to reproduce.

Problem is that ctools_export_crud_load loads the schema and thinks there is weight column. Not sure what should be done about it. With all these back-and-forth schema changes, it may be safest to not rely on ctools functions, and to use simple sql queries in the update function.

anon’s picture

Status: Active » Needs review
StatusFileSize
new958 bytes

This patchs does two things.

  1. Removed the weight field remove call in 7300. So when upgrading from 7.2, the weight will be migrated as well.
  2. Added check to see of the weight field exists in 7305. It will exists in case of an update from 7.2 from now on.
ciss’s picture

Installations at schema version 7300 will still have trouble passing 7302 7303. If you're not worried about those then the patch should be good to go.

miroslavbanov’s picture

See my notes in #5. Ctools crud functions call drupal_get_schema, so they shouldn't be used in update hooks. See: https://www.drupal.org/node/150220.

You fix your update now, it breaks the next time you change the schema.

anon’s picture

Status: Needs review » Needs work
barami’s picture

StatusFileSize
new1.07 KB

This patch copied from #5. And prevent side effect when change schema function in the future.

barami’s picture

StatusFileSize
new2.1 KB

This patch also modify linkit_update_7304 function to prevent side effect when schema function changed
(eg. when profile_type or admin_description field removed)

eliosh’s picture

Hi,
I was coming from 2.7 and patch in #11 doesn't work, with the same message as always:

$ drush updb
 Linkit  7303  Fixed 7302. Set URL type to "Entity view page" to preserve current behavior.  
 Linkit  7304  Make sure admin_description can be null.                                      
 Linkit  7305  Add profile 'weight' column.
Do you wish to run all pending updates? (y/n): y
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'weight' in 'field list'                                                                                                                                       [error]
Performed update: linkit_update_7303                                                                                                                                                                                  [ok]

featherbelly’s picture

@eliosh you'll probably need to run ALL of the updates again as the patch affects linkit_update_7300.

eliosh’s picture

@fatherbelly I've changed the system table and set schema_version to 7227.
Run drush updb and...

# drush8 updb

 Linkit  7300  Migrate settings from v2 to v3 if needed.                                     
 Linkit  7301  Do nothing. Update the schema version.                                        
 Linkit  7302  Reverted.                                                                     
 Linkit  7303  Fixed 7302. Set URL type to "Entity view page" to preserve current behavior.  
 Linkit  7304  Make sure admin_description can be null.                                      
 Linkit  7305  Add profile 'weight' column.
Do you wish to run all pending updates? (y/n): y
Performed update: linkit_update_7300                                                                                                      [ok]
Performed update: linkit_update_7301                                                                                                      [ok]
Performed update: linkit_update_7302                                                                                                      [ok]
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'weight' in 'field list'                                                           [error]

skylord’s picture

#11 worked fine for upgrade from 2.7 to 3.6. Have disabled module, replaced files, applied patch and run "drush updb".

danrod’s picture

Patch # 11 is not working for me, can anyone provide the steps on how to apply the patch and run the updates, please?

sthomen’s picture

StatusFileSize
new2.55 KB

This patch might work better. #11 requires that you have not already run 7300. Instead of removing the removal of the 'weight' field I just add it back in 7303. This patch (like #11) also removes the risky use of drupal_get_schema_unprocessed() (it will give you the _current_ schema, but how do you know it represents the expected schema at the given update?).

optasy’s picture

Patch #17 did the work for me, thanks for that @sthomen !

  • mark_fullmer committed ee10fb65 on 7.x-3.x authored by sthomen
    Issue #2842804 by barami, anon, sthomen, ciss, MiroslavBanov, eliosh,...
mark_fullmer’s picture

Status: Needs work » Fixed

Thanks for the input, everyone! I've committed the patch from #17 to the 7.x-3.x branch.

Status: Fixed » Closed (fixed)

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