Skip to content

Commit 363aba4

Browse files
authored
fix: ignore polymorphic relations in 4.5.1 migration (#1656)
1 parent 23c1177 commit 363aba4

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

docusaurus/docs/dev-docs/migration/v4/migration-guide-4.4.5-to-4.5.1.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,17 @@ const getLinkTables = ({ strapi }) => {
7878
const contentTypes = strapi.db.metadata;
7979
const tablesToUpdate = {};
8080

81-
contentTypes.forEach(contentType => {
81+
contentTypes.forEach((contentType) => {
8282
// Get attributes
8383
const attributes = contentType.attributes;
8484

8585
// For each relation type, add the joinTable name to tablesToUpdate
86-
Object.values(attributes).forEach(attribute => {
87-
if (attribute.type === 'relation' && attribute.joinTable) {
86+
Object.values(attributes).forEach((attribute) => {
87+
if (
88+
attribute.type === 'relation' &&
89+
attribute.joinTable &&
90+
!attribute.relation.startsWith('morph') // Ignore polymorphic relations
91+
) {
8892
tablesToUpdate[attribute.joinTable.name] = attribute.joinTable;
8993
}
9094
});

0 commit comments

Comments
 (0)