Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot delete multiple fields at once following EE2 > EE7 upgrade #2622

Closed
pyrobob83 opened this issue Dec 8, 2022 · 2 comments · Fixed by #2633
Closed

Cannot delete multiple fields at once following EE2 > EE7 upgrade #2622

pyrobob83 opened this issue Dec 8, 2022 · 2 comments · Fixed by #2633
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.

Comments

@pyrobob83
Copy link

Description of the problem
Cannot delete multiple fields from the Fields section. Not sure if it's specific to this particular build perhaps because of third-party fieldtypes, but Aasun reported the same thing in an EE2 > EE5 upgrade in Slack. Deleting fields 1-at-a-time however works just fine, just takes forever when there's dozens/hundreds to remove.

How To Reproduce
Steps to reproduce the behavior:

  1. Upgrade a site from EE2 > EE7 (I'm currently on 7.2.0)
  2. Go to Fields, choose any Field Group with multiple fields
  3. Use the checkboxes down the right-edge to select multiple fields to try to delete. It doesn't seem to make a difference how many (2+) or what types of fields are selected...
  4. At the bottom, select DELETE from the dropdown then Submit

Error Messages



Exception Caught
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'ee_m_ChannelEntry_channel_data.field_id_277' in 'field list':
SELECT ee_m_ChannelEntry_channel_titles.entry_id as ee_m_ChannelEntry__entry_id, ee_m_ChannelEntry_channel_titles.site_id as ee_m_ChannelEntry__site_id, ee_m_ChannelEntry_channel_titles.channel_id as ee_m_ChannelEntry__channel_id, ee_m_ChannelEntry_channel_titles.author_id as ee_m_ChannelEntry__author_id, ee_m_ChannelEntry_channel_titles.forum_topic_id as ee_m_ChannelEntry__forum_topic_id, ee_m_ChannelEntry_channel_titles.ip_address as ee_m_ChannelEntry__ip_address, ee_m_ChannelEntry_channel_titles.title as ee_m_ChannelEntry__title, ee_m_ChannelEntry_channel_titles.url_title as ee_m_ChannelEntry__url_title, ee_m_ChannelEntry_channel_titles.status as ee_m_ChannelEntry__status, ee_m_ChannelEntry_channel_titles.status_id as ee_m_ChannelEntry__status_id, ee_m_ChannelEntry_channel_titles.versioning_enabled as ee_m_ChannelEntry__versioning_enabled, ee_m_ChannelEntry_channel_titles.view_count_one as ee_m_ChannelEntry__view_count_one, ee_m_ChannelEntry_channel_titles.view_count_two as ee_m_ChannelEntry__view_count_two, ee_m_ChannelEntry_channel_titles.view_count_three as ee_m_ChannelEntry__view_count_three, ee_m_ChannelEntry_channel_titles.view_count_four as ee_m_ChannelEntry__view_count_four, ee_m_ChannelEntry_channel_titles.allow_comments as ee_m_ChannelEntry__allow_comments, ee_m_ChannelEntry_channel_titles.sticky as ee_m_ChannelEntry__sticky, ee_m_ChannelEntry_channel_titles.entry_date as ee_m_ChannelEntry__entry_date, ee_m_ChannelEntry_channel_titles.year as ee_m_ChannelEntry__year, ee_m_ChannelEntry_channel_titles.month as ee_m_ChannelEntry__month, ee_m_ChannelEntry_channel_titles.day as ee_m_ChannelEntry__day, ee_m_ChannelEntry_channel_titles.expiration_date as ee_m_ChannelEntry__expiration_date, ee_m_ChannelEntry_channel_titles.comment_expiration_date as ee_m_ChannelEntry__comment_expiration_date, ee_m_ChannelEntry_channel_titles.edit_date as ee_m_ChannelEntry__edit_date, ee_m_ChannelEntry_channel_titles.recent_comment_date as ee_m_ChannelEntry__recent_comment_date, ee_m_ChannelEntry_channel_titles.comment_total as ee_m_ChannelEntry__comment_total, ee_m_ChannelEntry_channel_data.entry_id as ee_m_ChannelEntry__entry_id, ee_m_ChannelEntry_channel_data.channel_id as ee_m_ChannelEntry__channel_id, ee_m_ChannelEntry_channel_data.site_id as ee_m_ChannelEntry__site_id, ee_m_ChannelEntry_channel_data.entry_id as ee_m_ChannelEntry__entry_id, ee_m_ChannelEntry_channel_data.site_id as ee_m_ChannelEntry__site_id, ee_m_ChannelEntry_channel_data.channel_id as ee_m_ChannelEntry__channel_id, ee_m_ChannelEntry_channel_data.field_id_17 as ee_m_ChannelEntry__field_id_17, ee_m_ChannelEntry_channel_data.field_ft_17 as ee_m_ChannelEntry__field_ft_17, ee_m_ChannelEntry_channel_data.field_id_18 as ee_m_ChannelEntry__field_id_18, ee_m_ChannelEntry_channel_data.field_ft_18 as ee_m_ChannelEntry__field_ft_18, ee_m_ChannelEntry_channel_data.field_id_19 as ee_m_ChannelEntry__field_id_19, ee_m_ChannelEntry_channel_data.field_ft_19 as ee_m_ChannelEntry__field_ft_19, ee_m_ChannelEntry_channel_data.field_id_20 as ee_m_ChannelEntry__field_id_20, ee_m_ChannelEntry_channel_data.field_ft_20 as ee_m_ChannelEntry__field_ft_20,
[... removed a bunch of fields/lines that followed the same format for legibility ...]
ee_m_ChannelEntry_channel_data.field_id_481 as ee_m_ChannelEntry__field_id_481, ee_m_ChannelEntry_channel_data.field_ft_481 as ee_m_ChannelEntry__field_ft_481, ee_m_ChannelEntry_channel_data.field_id_482 as ee_m_ChannelEntry__field_id_482, ee_m_ChannelEntry_channel_data.field_ft_482 as ee_m_ChannelEntry__field_ft_482, CurrentlyDeleting_channel_fields.field_id as CurrentlyDeleting__field_id, CurrentlyDeleting_channel_fields.site_id as CurrentlyDeleting__site_id, CurrentlyDeleting_channel_fields.field_name as CurrentlyDeleting__field_name, CurrentlyDeleting_channel_fields.field_label as CurrentlyDeleting__field_label, CurrentlyDeleting_channel_fields.field_instructions as CurrentlyDeleting__field_instructions, CurrentlyDeleting_channel_fields.field_type as CurrentlyDeleting__field_type, CurrentlyDeleting_channel_fields.field_list_items as CurrentlyDeleting__field_list_items, CurrentlyDeleting_channel_fields.field_pre_populate as CurrentlyDeleting__field_pre_populate, CurrentlyDeleting_channel_fields.field_pre_channel_id as CurrentlyDeleting__field_pre_channel_id, CurrentlyDeleting_channel_fields.field_pre_field_id as CurrentlyDeleting__field_pre_field_id, CurrentlyDeleting_channel_fields.field_ta_rows as CurrentlyDeleting__field_ta_rows, CurrentlyDeleting_channel_fields.field_maxl as CurrentlyDeleting__field_maxl, CurrentlyDeleting_channel_fields.field_required as CurrentlyDeleting__field_required, CurrentlyDeleting_channel_fields.field_text_direction as CurrentlyDeleting__field_text_direction, CurrentlyDeleting_channel_fields.field_search as CurrentlyDeleting__field_search, CurrentlyDeleting_channel_fields.field_is_hidden as CurrentlyDeleting__field_is_hidden, CurrentlyDeleting_channel_fields.field_is_conditional as CurrentlyDeleting__field_is_conditional, CurrentlyDeleting_channel_fields.field_fmt as CurrentlyDeleting__field_fmt, CurrentlyDeleting_channel_fields.field_show_fmt as CurrentlyDeleting__field_show_fmt, CurrentlyDeleting_channel_fields.field_order as CurrentlyDeleting__field_order, CurrentlyDeleting_channel_fields.field_content_type as CurrentlyDeleting__field_content_type, CurrentlyDeleting_channel_fields.field_settings as CurrentlyDeleting__field_settings, CurrentlyDeleting_channel_fields.legacy_field_data as CurrentlyDeleting__legacy_field_data, CurrentlyDeleting_channel_fields.enable_frontedit as CurrentlyDeleting__enable_frontedit FROM (`exp_channel_titles` as ee_m_ChannelEntry_channel_titles, `exp_channel_data` as ee_m_ChannelEntry_channel_data) LEFT JOIN `exp_channel_entry_hidden_fields` as ee_m_ChannelEntry_CurrentlyDeleting_channel_entry_hidden_fields ON `ee_m_ChannelEntry_CurrentlyDeleting_channel_entry_hidden_fields`.`entry_id` = `ee_m_ChannelEntry_channel_titles`.`entry_id` LEFT JOIN `exp_channel_fields` as CurrentlyDeleting_channel_fields ON `CurrentlyDeleting_channel_fields`.`field_id` = `ee_m_ChannelEntry_CurrentlyDeleting_channel_entry_hidden_fields`.`field_id` WHERE ee_m_ChannelEntry_channel_data.entry_id = ee_m_ChannelEntry_channel_titles.entry_id AND ( `CurrentlyDeleting_channel_fields`.`field_id` IN (284) ) LIMIT 100

ee/legacy/database/drivers/mysqli/mysqli_connection.php:114
Stack Trace: Please include when reporting this error

    #0 ee/legacy/database/drivers/mysqli/mysqli_driver.php(112): CI_DB_mysqli_connection->query('SELECT ee_m_Cha...')
    #1 ee/legacy/database/DB_driver.php(260): CI_DB_mysqli_driver->_execute('SELECT ee_m_Cha...')
    #2 ee/legacy/database/DB_driver.php(175): CI_DB_driver->simple_query('SELECT ee_m_Cha...')
    #3 ee/legacy/database/DB_active_rec.php(1083): CI_DB_driver->query('SELECT ee_m_Cha...')
    #4 ee/ExpressionEngine/Service/Model/Query/Select.php(60): CI_DB_active_record->get()
    #5 ee/ExpressionEngine/Service/Model/DataStore.php(275): ExpressionEngine\Service\Model\Query\Select->run()
    #6 ee/ExpressionEngine/Service/Model/DataStore.php(220): ExpressionEngine\Service\Model\DataStore->runQuery('Select', Object(ExpressionEngine\Service\Model\Query\Builder))
    #7 ee/ExpressionEngine/Service/Model/Query/Builder.php(150): ExpressionEngine\Service\Model\DataStore->selectQuery(Object(ExpressionEngine\Service\Model\Query\Builder))
    #8 ee/ExpressionEngine/Service/Model/Query/Builder.php(63): ExpressionEngine\Service\Model\Query\Builder->fetch(false)
    #9 ee/ExpressionEngine/Service/Model/Query/Delete.php(352): ExpressionEngine\Service\Model\Query\Builder->all()
    #10 ee/ExpressionEngine/Service/Model/Query/Delete.php(70): ExpressionEngine\Service\Model\Query\Delete->ExpressionEngine\Service\Model\Query\{closure}(Object(ExpressionEngine\Service\Model\Query\Builder))
    #11 ee/ExpressionEngine/Service/Model/DataStore.php(275): ExpressionEngine\Service\Model\Query\Delete->run()
    #12 ee/ExpressionEngine/Service/Model/DataStore.php(250): ExpressionEngine\Service\Model\DataStore->runQuery('Delete', Object(ExpressionEngine\Service\Model\Query\Builder))
    #13 ee/ExpressionEngine/Service/Model/Query/Builder.php(87): ExpressionEngine\Service\Model\DataStore->deleteQuery(Object(ExpressionEngine\Service\Model\Query\Builder))
    #14 ee/ExpressionEngine/Service/Model/Model.php(403): ExpressionEngine\Service\Model\Query\Builder->delete()
    #15 [internal function]: ExpressionEngine\Service\Model\Model->delete()
    #16 ee/ExpressionEngine/Library/Data/Collection.php(79): call_user_func_array(Array, Array)
    #17 [internal function]: ExpressionEngine\Library\Data\Collection->ExpressionEngine\Library\Data\{closure}(Object(ExpressionEngine\Model\Channel\ChannelField))
    #18 ee/ExpressionEngine/Library/Data/Collection.php(233): array_map(Object(Closure), Array)
    #19 ee/ExpressionEngine/Library/Data/Collection.php(86): ExpressionEngine\Library\Data\Collection->map(Object(Closure))
    #20 ee/ExpressionEngine/Controller/Fields/Fields.php(947): ExpressionEngine\Library\Data\Collection->__call('delete', Array)
    #21 ee/ExpressionEngine/Controller/Fields/Fields.php(34): ExpressionEngine\Controller\Fields\Fields->remove(Array)
    #22 [internal function]: ExpressionEngine\Controller\Fields\Fields->index()
    #23 ee/ExpressionEngine/Core/Core.php(268): call_user_func_array(Array, Array)
    #24 ee/ExpressionEngine/Core/Core.php(124): ExpressionEngine\Core\Core->runController(Array)
    #25 ee/ExpressionEngine/Boot/boot.php(184): ExpressionEngine\Core\Core->run(Object(ExpressionEngine\Core\Request))
    #26 public/admin.php(139): require_once('ee/...')
    #26 public/admin.php(139): require_once('ee/...') 

Environment Details:

  • EE Version: 7.2.0
  • PHP Version: 8.1.8
  • MariaDB Version: 10.5
@robinsowell robinsowell added the Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on. label Dec 8, 2022
@robinsowell
Copy link
Contributor

robinsowell commented Dec 8, 2022

We've got multiple folks in slack reporting the same thing and I have a user in support.

It's only older sites that were upgraded, but I can't pinpoint exactly what's doing it. At first I thought it was db corruption, but I think it's just a flat bug. See internal report for database.

@intoeetive
Copy link
Contributor

it could be that fields have legacy_field_data column set to y in exp_channel_fields but in fact the field is using it's own database table. If that is the situation, it likely happened somewhere in migration process (and there might be already a fix, just it wouldn't apply to the sites that already migrated)

or it could be something else as well

matthewjohns0n added a commit that referenced this issue Dec 19, 2022
…-queries

Resolved #2622 where deleting several legacy channel fields could cause MySQL error
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Accepted Bug has been confirmed, is reproducible, and ready to work on.
Projects
None yet
3 participants