@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.
@@ -1 +1 @@
1
- {"version":3,"file":"5.0.0-discard-drafts.d.ts","sourceRoot":"","sources":["../../../src/migrations/database/5.0.0-discard-drafts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAY5D,KAAK,eAAe,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9D,KAAK,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAk1G3C;;;;;GAKG;AACH,wBAAuB,iBAAiB,CAAC,EACvC,EAAE,EACF,GAAG,EACH,GAAG,EACH,gBAAuB,GACxB,EAAE;IACD,EAAE,EAAE,QAAQ,CAAC;IACb,GAAG,EAAE,IAAI,CAAC;IACV,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,oDAwBA;AAED,eAAO,MAAM,qBAAqB,EAAE,SAQnC,CAAC"}
1
+ {"version":3,"file":"5.0.0-discard-drafts.d.ts","sourceRoot":"","sources":["../../../src/migrations/database/5.0.0-discard-drafts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAIH,OAAO,KAAK,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAY5D,KAAK,eAAe,GAAG;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9D,KAAK,IAAI,GAAG,UAAU,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAy2G3C;;;;;GAKG;AACH,wBAAuB,iBAAiB,CAAC,EACvC,EAAE,EACF,GAAG,EACH,GAAG,EACH,gBAAuB,GACxB,EAAE;IACD,EAAE,EAAE,QAAQ,CAAC;IACb,GAAG,EAAE,IAAI,CAAC;IACV,GAAG,EAAE,MAAM,CAAC;IACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,oDAwBA;AAED,eAAO,MAAM,qBAAqB,EAAE,SAQnC,CAAC"}
@@ -1090,6 +1090,10 @@ const debug = createDebug('strapi::migration::discard-drafts');
1090
1090
  }
1091
1091
  const joinTable = attribute.joinTable;
1092
1092
  const sourceColumnName = joinTable.joinColumn.name;
1093
+ // Morph join tables use morphColumn instead of inverseJoinColumn — skip them
1094
+ if (!joinTable.inverseJoinColumn) {
1095
+ continue;
1096
+ }
1093
1097
  const targetColumnName = joinTable.inverseJoinColumn.name;
1094
1098
  if (!componentMeta.relationsLogPrinted) {
1095
1099
  debug(`[cloneComponentRelationJoinTables] Inspecting join table ${joinTable.name} for component ${componentUid}`);
@@ -1381,6 +1385,10 @@ const debug = createDebug('strapi::migration::discard-drafts');
1381
1385
  continue;
1382
1386
  }
1383
1387
  const { name: sourceColumnName } = joinTable.joinColumn;
1388
+ // Morph join tables use morphColumn instead of inverseJoinColumn — skip them
1389
+ if (!joinTable.inverseJoinColumn) {
1390
+ continue;
1391
+ }
1384
1392
  const { name: targetColumnName } = joinTable.inverseJoinColumn;
1385
1393
  // Process in batches to avoid MySQL query size limits and SQLite expression tree limits
1386
1394
  const publishedIdsChunks = chunkArray(publishedIds, getBatchSize(trx, 1000));
@@ -1480,6 +1488,9 @@ const debug = createDebug('strapi::migration::discard-drafts');
1480
1488
  continue;
1481
1489
  }
1482
1490
  const { name: sourceColumnName } = joinTable.joinColumn;
1491
+ if (!joinTable.inverseJoinColumn) {
1492
+ continue;
1493
+ }
1483
1494
  const { name: targetColumnName } = joinTable.inverseJoinColumn;
1484
1495
  // Query existing relations by target IDs to avoid duplicates
1485
1496
  const existingKeys = await getExistingRelationKeys({
@@ -1553,6 +1564,9 @@ const debug = createDebug('strapi::migration::discard-drafts');
1553
1564
  continue;
1554
1565
  }
1555
1566
  const { name: sourceColumnName } = joinTable.joinColumn;
1567
+ if (!joinTable.inverseJoinColumn) {
1568
+ continue;
1569
+ }
1556
1570
  const { name: targetColumnName } = joinTable.inverseJoinColumn;
1557
1571
  // Get target content type's publishedToDraftMap if it has draft/publish (cached)
1558
1572
  const targetUid = attribute.target;
@@ -1789,6 +1803,9 @@ const debug = createDebug('strapi::migration::discard-drafts');
1789
1803
  continue;
1790
1804
  }
1791
1805
  const { name: sourceColumnName } = joinTable.joinColumn;
1806
+ if (!joinTable.inverseJoinColumn) {
1807
+ continue;
1808
+ }
1792
1809
  const { name: targetColumnName } = joinTable.inverseJoinColumn;
1793
1810
  // Get draft map for target to convert published targets to draft targets
1794
1811
  const targetDraftMap = await getDraftMapForTarget(trx, targetUid, draftMapCache);
@@ -1935,6 +1952,9 @@ const debug = createDebug('strapi::migration::discard-drafts');
1935
1952
  if (!targetHasDP) continue;
1936
1953
  const relationJoinTable = attr.joinTable.name;
1937
1954
  const sourceColumn = attr.joinTable.joinColumn.name;
1955
+ if (!attr.joinTable.inverseJoinColumn) {
1956
+ continue;
1957
+ }
1938
1958
  const targetColumn = attr.joinTable.inverseJoinColumn.name;
1939
1959
  const hasRelationTable = await trx.schema.hasTable(relationJoinTable);
1940
1960
  if (!hasRelationTable) continue;
@@ -2104,6 +2124,9 @@ const debug = createDebug('strapi::migration::discard-drafts');
2104
2124
  if (!targetContentType?.options?.draftAndPublish) continue;
2105
2125
  const relationJoinTable = attr.joinTable.name;
2106
2126
  const sourceColumn = attr.joinTable.joinColumn.name;
2127
+ if (!attr.joinTable.inverseJoinColumn) {
2128
+ continue;
2129
+ }
2107
2130
  const targetColumn = attr.joinTable.inverseJoinColumn.name;
2108
2131
  if (!await ensureTableExists(trx, relationJoinTable)) continue;
2109
2132
  const relations = await trx(relationJoinTable).whereIn(sourceColumn, ids).select('id', sourceColumn, targetColumn);