@strapi/core 5.46.0 → 5.46.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1088,6 +1088,10 @@ const debug = createDebug('strapi::migration::discard-drafts');
1088
1088
  }
1089
1089
  const joinTable = attribute.joinTable;
1090
1090
  const sourceColumnName = joinTable.joinColumn.name;
1091
+ // Morph join tables use morphColumn instead of inverseJoinColumn — skip them
1092
+ if (!joinTable.inverseJoinColumn) {
1093
+ continue;
1094
+ }
1091
1095
  const targetColumnName = joinTable.inverseJoinColumn.name;
1092
1096
  if (!componentMeta.relationsLogPrinted) {
1093
1097
  debug(`[cloneComponentRelationJoinTables] Inspecting join table ${joinTable.name} for component ${componentUid}`);
@@ -1379,6 +1383,10 @@ const debug = createDebug('strapi::migration::discard-drafts');
1379
1383
  continue;
1380
1384
  }
1381
1385
  const { name: sourceColumnName } = joinTable.joinColumn;
1386
+ // Morph join tables use morphColumn instead of inverseJoinColumn — skip them
1387
+ if (!joinTable.inverseJoinColumn) {
1388
+ continue;
1389
+ }
1382
1390
  const { name: targetColumnName } = joinTable.inverseJoinColumn;
1383
1391
  // Process in batches to avoid MySQL query size limits and SQLite expression tree limits
1384
1392
  const publishedIdsChunks = chunkArray(publishedIds, getBatchSize(trx, 1000));
@@ -1478,6 +1486,9 @@ const debug = createDebug('strapi::migration::discard-drafts');
1478
1486
  continue;
1479
1487
  }
1480
1488
  const { name: sourceColumnName } = joinTable.joinColumn;
1489
+ if (!joinTable.inverseJoinColumn) {
1490
+ continue;
1491
+ }
1481
1492
  const { name: targetColumnName } = joinTable.inverseJoinColumn;
1482
1493
  // Query existing relations by target IDs to avoid duplicates
1483
1494
  const existingKeys = await getExistingRelationKeys({
@@ -1551,6 +1562,9 @@ const debug = createDebug('strapi::migration::discard-drafts');
1551
1562
  continue;
1552
1563
  }
1553
1564
  const { name: sourceColumnName } = joinTable.joinColumn;
1565
+ if (!joinTable.inverseJoinColumn) {
1566
+ continue;
1567
+ }
1554
1568
  const { name: targetColumnName } = joinTable.inverseJoinColumn;
1555
1569
  // Get target content type's publishedToDraftMap if it has draft/publish (cached)
1556
1570
  const targetUid = attribute.target;
@@ -1787,6 +1801,9 @@ const debug = createDebug('strapi::migration::discard-drafts');
1787
1801
  continue;
1788
1802
  }
1789
1803
  const { name: sourceColumnName } = joinTable.joinColumn;
1804
+ if (!joinTable.inverseJoinColumn) {
1805
+ continue;
1806
+ }
1790
1807
  const { name: targetColumnName } = joinTable.inverseJoinColumn;
1791
1808
  // Get draft map for target to convert published targets to draft targets
1792
1809
  const targetDraftMap = await getDraftMapForTarget(trx, targetUid, draftMapCache);
@@ -1933,6 +1950,9 @@ const debug = createDebug('strapi::migration::discard-drafts');
1933
1950
  if (!targetHasDP) continue;
1934
1951
  const relationJoinTable = attr.joinTable.name;
1935
1952
  const sourceColumn = attr.joinTable.joinColumn.name;
1953
+ if (!attr.joinTable.inverseJoinColumn) {
1954
+ continue;
1955
+ }
1936
1956
  const targetColumn = attr.joinTable.inverseJoinColumn.name;
1937
1957
  const hasRelationTable = await trx.schema.hasTable(relationJoinTable);
1938
1958
  if (!hasRelationTable) continue;
@@ -2102,6 +2122,9 @@ const debug = createDebug('strapi::migration::discard-drafts');
2102
2122
  if (!targetContentType?.options?.draftAndPublish) continue;
2103
2123
  const relationJoinTable = attr.joinTable.name;
2104
2124
  const sourceColumn = attr.joinTable.joinColumn.name;
2125
+ if (!attr.joinTable.inverseJoinColumn) {
2126
+ continue;
2127
+ }
2105
2128
  const targetColumn = attr.joinTable.inverseJoinColumn.name;
2106
2129
  if (!await ensureTableExists(trx, relationJoinTable)) continue;
2107
2130
  const relations = await trx(relationJoinTable).whereIn(sourceColumn, ids).select('id', sourceColumn, targetColumn);