Data loss after attempting latest update

Created on 2 August 2014, almost 10 years ago
Updated 4 October 2023, 9 months ago

field_encrypt_update_7000() runs with mysql errors (duplicate insert). But by that time, db_drop_table('field_encrypt'); has already dropped the table. So all data is lost.

This kind of drop_table statement should be in a separate field_encrypt_update_7001(), so the first update can run correctly before dropping the table. To avoid data loss.

I luckily had a backup so I could restore the field_encrypt table.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡¨πŸ‡¦Canada nubeli

    Looks like this is unlikely to be fixed in the 7.x-1,x branch. Thank you Tom and Manuel for the patches. I ended up using the batched process patch ( https://www.drupal.org/files/issues/2018-05-31/2314327-16.patch β†’ ) in my patch to the Backdrop port of this module: https://github.com/backdrop-contrib/field_encrypt/pull/6/files. It is almost identical so I thought I'd share it here. I had to fix some issues with that patch:

    • It should be comparing this: $vid == $result->revision_id, not $id == $result->revision_id. In the latter it never populates the field_data_* table
    • I have it checking if the entity exists in case an entity was deleted but didn't delete the record in the table (which happened to me).
    • There is one field_encrypt_encrypt() call that has a fatal error because it's missing a line to load the inc file. Should have module_load_include('inc', 'field_encrypt', 'field_encrypt'); above the foreach.
    • I also added some checks for db_table_exists() because you never know.

    After that it ran fine, and I believe it should work fine for Drupal 7 as well. I had a client that was using the old beta and there is no working upgrade path for the 7.x-1.x branch so I decided to incorporate it into the Backdrop port so others can benefit as well.

Production build 0.69.0 2024