X Tutup
Skip to content

First-time CSV import validation messages do not show #930

@mstenta

Description

@mstenta

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:

// 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:

  1. Install farm_migrate_csv on a fresh farmOS instance.
  2. Download the template for an Activity log CSV.
  3. Only fill in the name column of the first row (leave timestamp blank so that validation fails).
  4. Import the CSV.
  5. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      X Tutup