Open zbandar opened 1 year ago
@zbandar I am facing this issue too. Were you able to find a solution?
@zbandar @shobhitsinghal624 did you find any solutions for this ?
Hey @shobhitsinghal624 @sawnn , we made a modification to the migrateRelations function in the file located at strapi/migration-scripts/v3-sql-v4-sql/migrate/helpers/relationHelpers.js. I updated the code starting from line 176 to the following:
for (const relation of relations) {
if (relation.type === 'oneToOne') {
await migrateOneToOneRelation(relation);
} else if (relation.type === 'manyToMany') {
const modelF = relation.modelF.replace("-", "_");
const attribute = snakeCase(relation.attribute);
var sourceTable = v3RelationTables.find(
(t) =>
t === `${relation.model}__${attribute}` ||
t.startsWith(`${relation.model}_${attribute}__${modelF}`) ||
(t.startsWith(`${modelF}`) && t.endsWith(`__${relation.model}_${attribute}`))
);
if (sourceTable) {
await migrateManyToManyRelation(relation, sourceTable);
}
}
}
This change worked for me, and I hope it proves helpful for you as well.
Bug report
Required System information
Describe the bug
In the strapi v3 i have tables :
components_story_group_stories__stories
with columnsid
|components_story_group_story_id
|story_id
components_puzzle_group_puzzles__puzzles
with columnsid
|components_puzzle_group_puzzle_id
|puzzle_id
I migrated my strapi from v3 to v4 using codemods. And pointed strapi to new empty db and generated schema. After migrating the strapi following changes happen
components_story_group_stories_stories_links
with the columnsid
|group_stories_id
|story_id
|story_order
components_puzzle_group_puzzles_puzzles_links
with columnsid
|group_puzzles_id
|puzzle_id
|puzzle_order
**there are more like these tablesWhen i tried to migrate the data from v3 to v4 the column
group_stories_id
andgroup_puzzles_id
are skipped Showing this in the console -WARNING - items of components_story_group_stories_stories_links was filtered ["group_story_id"]
WARNING - items of components_puzzle_group_puzzles_puzzles_links was filtered ["group_puzzle_id"]
In columnsgroup_story_id
andgroup_puzzle_id
NULL
value is showingThe other issue with the same process is no data is migarted for some tables: in v3 i have a table
components_game_group_games__game_sets
with columnsid
|components_game_group_game_id
|game-set_id
after migrating it to the v4 the table is renamed ascomponents_game_group_games_game_sets_links
with columns name asid
|group_games_id
|game_set_id
|game_set_order
After running the migration script the table is still empty in v4 db and data for this table is not migrated from v3 to v4.Expected behavior
All the data should have been migrated from v3 to v4 PostgreSQL.
Screenshots
Tables in v3
Tables in v4