-
-
Notifications
You must be signed in to change notification settings - Fork 345
Description
Opening this as a follow-up to #924... because it is slightly different, and more complicated to fix.
As I was debugging #924 I came across this comment in our code for loading and displaying migration messages (eg: validation errors) after a CSV import:
farmOS/modules/core/import/modules/csv/src/EventSubscriber/CsvMigrationSubscriber.php
Lines 124 to 128 in d999b1b
| // Query the migrate_map_* table, if it exists. | |
| // Migrate map tables are generated on-the-fly by the Drupal core migrate | |
| // module, only when needed. If no rows get imported (due to validation | |
| // errors, empty CSV files, etc), then the table will not be generated | |
| // when this code runs. |
This made me realize that this code will not work under certain conditions. Specifically, if this is the first time that a certain CSV importer is used, and validation fails, then the migrate_map_* table will not be created, and we will not be able to load the validation message.
Steps to reproduce:
- Install
farm_migrate_csvon a fresh farmOS instance. - Download the template for an Activity log CSV.
- Only fill in the
namecolumn of the first row (leavetimestampblank so that validation fails). - Import the CSV.
- Notice that the validation message is not shown.
This is a bit of a deep issue because the way we are loading the messages (after migration happens) relies on the migrate_map_* table existing, but Drupal core doesn't create that when no items are imported.