fix(migrations): defensive checks for ms3_grid_fields table#271
Merged
Conversation
Add hasTable() checks to prevent SQLSTATE[42S02] errors during installation when ms3_grid_fields table doesn't exist yet. Fixes #270
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Описание
Добавлены защитные проверки (defensive checks) во все seed-миграции таблицы
ms3_grid_fieldsдля предотвращения ошибкиSQLSTATE[42S02]: Base table or view not foundпри установке MiniShop3.Проблема:
При установке на чистый MODX или при повторной установке, миграции пытались вставить данные в таблицу
ms3_grid_fieldsдо её создания, что приводило к фатальной ошибке.Решение:
hasTable()перед выполнением всех операций с таблицейdown()от ошибок при отсутствии таблицыtable_prefixчерезgetAdapter()->getOption('table_prefix') ?? ''Затронутые миграции:
20251127000002_seed_customers_grid_config.php20251204140000_seed_orders_grid_config.php20251215120000_seed_order_products_grid_config.php20251222120000_seed_deliveries_grid_config.php20251223130000_seed_vendors_grid_config.php20251231140000_seed_category_products_grid_config.php20260107120000_fix_orders_grid_filterable.php20260119220000_update_orders_grid_status_fields.php20260317120000_add_duplicate_publish_to_category_products_actions.phpТип изменений
Связанные Issues
Fixes #270
Как это было протестировано?
Конфигурация тестирования:
Чеклист
Дополнительные заметки
Issue было создано на основе комментария на modx.pro.