-
Notifications
You must be signed in to change notification settings - Fork 60
Data of relations in some cases not migrated #70
Comments
can confirm this issue as well |
Or is this a codemods issue? |
I have same issue |
Fairly certain this is codemods related and is likely related to strapi/codemods#44 |
If I understand issue strapi/codemods#44 correctly, then it doesn't seem to be related to the previously missing component migrations fixed by @derrickmehaffy's PR strapi/codemods#46. Because the issue I have reported here is not related to components, it is related to collection types directly. |
For me personally I switched the |
Interesting can anyone else shed some light on reproducing the issue as I couldn't reproduce this (it may not be codemods related so I'll move this back to the data migrations repo) |
Can confirm i've had the same issue, all manyToMany relations are lost when the migration script is run. All other relations work fine, but manyToMany are lost with the exact symptoms described by the OP Edit: This is fixed by switching around "inversedBy" and "mappedBy" in the relevant scheme files after running the codemods. After swapping these around, generate a fresh db file by doing "yarn develop", then run the migration scrips as normal. I found i also had to manually create the "up_users" and "up_users_role_links" tables but the data is then migrated properly. |
For users-permissions, that one is an issue with codemods, we have already patched it but pending a new release of codemods (hopefully tomorrow). I'll try again to reproduce this issue with data migrations. |
@GregorSondermeier Hi, I was wondering if you really solved the problem with replacing "inversedBy" with "mappedBy" or you found another way to move all the data? If the first option, then the procedure looks like this -> replacing "inversedBy" with "mappedBy" -> yarn develop -> scripts for database migration? Thank You in advance. |
@Andrii23LV Sorry I can't remember, too long ago |
Bug report
Required System information
Describe the bug
In some cases, many-to-many relations are not properly migrated and data is missing.
It looks like it has something to do with which attribute is the
dominant
one, or with the alphabetical order of the referenced content-types, or with the name of the table that stores the relations.Steps to reproduce the behavior
npx create-strapi-app@v3 my-project --quickstart
to generate an empty Strapi v3 projectInstead of adding the many-to-many relation into the category, add it to the restaurant
npm i
npm run build && npm run develop
to start Strapi v4 and let it generate the empty tables, kill process afterwardsnpm run develop
to start Strapi v4Expected behavior
The restaurant_categories_links table contains the migrated many-to-many-relations.
Additional info
With the "How to reproduce" guide in mind this might look like an artificial issue. But we're currently migrating a v3 project which has been in production for 1.5 years to v4. That project contains some many-to-many relations of all sorts and changing how these relations are defined while ensuring data integrity is something I'm a little afraid of :)
By pure chance I found out that some data is missing. I hope there isn't more :(
If you try to reproduce this issue, pay attention to step 2:
When I create the many-to-many relation in the category as described in the Quick Start Guide, the many-to-many relation gets properly migrated. Only when I create it the other way round the migration does not happen.
I suspect it has something to do with either the alphabetical order of the content-type name, or with the
dominant
property of the attribute.Although the
dominant
property would be weird, because the doc mentions that that one is used for NoSQL databases only.When it's like this the migration will work:
But when it's like this the migration will not work:
The text was updated successfully, but these errors were encountered: