Skip to content
This repository has been 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

Open
geoffreyhach opened this issue Sep 19, 2023 · 1 comment
Open

Comments

@geoffreyhach
Copy link

geoffreyhach commented Sep 19, 2023

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 !

@brechtvalcke
Copy link

brechtvalcke commented Oct 28, 2023

I second this proposed change, this gets me further to a working script for my strapi instance.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants