Skip to content
This repository was archived by the owner on Oct 7, 2024. It is now read-only.
This repository was archived by the owner on Oct 7, 2024. It is now read-only.

v3-mongodb-v3-sql : empty column causing bug on the map method #111

@geoffreyhach

Description

@geoffreyhach

Bug report

Issue Description

When running the script, if a column with a many-to-many relation is empty or contains null values, the script terminates prematurely. This issue occurs because the map method is called on a null value in such cases.

Steps to Reproduce

  1. Run the migration script.
  2. Encounter a column with a many-to-many relation that is empty or contains null values.

Expected Behavior

The script should gracefully handle cases where columns in many-to-many relations are empty or contain null values, allowing it to continue processing other data.

Temporary fix?

Found a solution for my specific use case adding guards like this
line 214 : const rows = (entry[key] ?? []).map((e, idx) => ({ ... })

line 270 : if (!entry[key] || !idMap.get(entry[key])) { continue; }

I don't know if i shoud submit a Pull Request with this fix or if something more robust will be added, let me know !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions