146 Commits

Author SHA1 Message Date
Boaz Poolman ec72af97f0 Fix polymorphic relations in the document service API (#26099)
* chore: remove early exit for morph relation types

* fix: issues with creating morphToOne relations

* chore: add tests

* test: add polymorphic relations tests

---------

Co-authored-by: Ben Irvin <ben@innerdvations.com>
2026-04-30 11:58:02 +02:00
Ziyi 7f7c1c3403 fix(database): make 5.0.0-02-created-document-id migration idempotent (#26045)
Previously the migration could leave the DB in an unbootable state after
a statement_timeout or process kill: the document_id column existed but
the migration was not recorded, and the retry crashed with PG 42701
"column already exists". Additionally, when hasColumn returned true
the migration early-exited via continue, silently skipping the backfill
and leaving rows with NULL document_id.

- Swallow duplicate-column errors (PG 42701, MySQL 1060, generic
  /duplicate column/i) around ALTER TABLE ADD COLUMN to tolerate
  catalog drift / operator-applied partial fixes.
- Always run the document_id backfill when the column exists; the
  backfill already uses WHERE document_id IS NULL so it is a no-op on
  fully-populated tables and recovery on partially-populated ones.
- Add unit tests covering fresh run, column-already-exists,
  PG 42701, MySQL 1060, and non-duplicate errors.

Fixes CMS-689
2026-04-24 09:12:57 +02:00
Yohei Yamamoto 12dfbe97c9 chore: fix typos in comments and docs 2026-04-07 14:32:50 +02:00
guoyangzhen 8af200e5e0 fix: change return to continue in deleteRelations when using foreign keys (#25857)
* test(api): add morphToMany delete test

---------

Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
2026-03-31 10:26:56 +02:00
Ben Irvin cc6b0c661b fix: use max batch sizes per dialect (#25390) 2026-03-30 09:39:46 +02:00
markkaylor ad0cb5e494 chore(core): parallelize and cache dynamic zone populate (#25685) 2026-03-12 14:43:58 +01:00
Jamie Howard 1153e05e6e [CM] request-scoped caching and parallelisation (#24999)
* fix(core): request-scoped model cache for validateParams

* chore(model-cache): enhance documentation

* feat: cache permission calculations in sanitize and validate services, reduce db queries

* chore: replace hardcoded prefix with constant for content manager store keys

* feat: parallel tranversal and further caching

* chore: extract shared utilities

* feat: add performance benchmarking for deeply nested content management

* chore: improve error handling in parallel processing of arrays

* chore: add TODO

* feat: enhance performance benchmark script

* Potential fix for code scanning alert no. 65: Clear-text logging of sensitive information

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>

* fix: improve error message

* chore(content-manager): revert dynamic populate depth

* feat: optimize permission checking and caching mechanisms

* test: componentService strapi mock

* fix: permission-checker tests types

* fix: remove redundant permission check in collection-types controller

* chore: remove performance benchmarking files and related configurations

---------

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
2026-01-22 15:49:27 +00:00
Araksya Gevorgyan e7ae51b01f feat(core): adding clear button to boolean toggle (#24836)
feat(core): adding clear button to boolean toggle
2025-12-02 17:33:05 +01:00
dollaransh17 222401a886 Fix spelling errors in error messages (#24501)
Changed 'occured' to 'occurred' in:
- DatabaseError constructor
- ApplicationError constructor
- API error handler

Authored-by: dollaransh17 <dollaransh17@users.noreply.github.com>
2025-10-09 15:00:00 +02:00
markkaylor 536eed0201 fix: database is corrupt with orphaned relations (#24316)
* fix: database is corrupt with orphaned relations

* chore: move script to document service and refactor

* fix: refactoring cleanup script

* fix: some improvements

* test(api): add unidirectional join table repair tests

* test(api): remove debug logs

* fix: orphaned relation nested compo (#24387)

---------

Co-authored-by: Bassel Kanso <basselkanso82@gmail.com>
Co-authored-by: Ben Irvin <ben@innerdvations.com>
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
2025-09-23 10:11:48 +02:00
Bassel Kanso a1da9b829e fix: syncing components in draft and publish relations (#24227)
Co-authored-by: Mark Kaylor <mark.kaylor@strapi.io>
Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
Co-authored-by: Jamie Howard <48524071+jhoward1994@users.noreply.github.com>
2025-09-03 16:39:31 +02:00
Ziyi 56f4f610f1 fix(core): handle time to dateTime and dateTime to time conversion with postgres (#24073)
* fix(core): handle time to dateTime and dateTime to time conversion with default value

* fix(core): add conversion utility function, fix linting

* fix: add eorror handling for getCurrentColumnType

* use transaction connection

* fix: escape set default placeholder

* fix(database): linting issue
2025-08-05 13:12:47 +03:00
markkaylor 063e359981 fix: one to many relations returns published and draft versions (#23673) 2025-06-06 17:06:45 +02:00
DMehaffy b445ac2d35 enhancement(database): change schema hash from md5 to sha256 (#23116) 2025-05-21 13:32:43 +02:00
DMehaffy 76977370da fix: optimize schema validation lookup for mysql/mariadb (#23331) 2025-04-10 06:53:05 -07:00
Jean-Sébastien Herbaux f271284c75 fix(database): improve sub queries handling in the qb (#23129) 2025-03-20 10:31:36 +01:00
Bassel Kanso 4c7e9e6971 fix: make sure to clean _cmp tables from orphaned morph types (#23000) 2025-02-26 18:03:38 +02:00
Dhruv Maradiya 0521e81a13 fix: delete previous relations in morph to many relation (#22736) 2025-02-07 16:27:34 +01:00
Bassel Kanso a28002c793 fix: disable lifecycle hooks on transfers [v5] (#22651) 2025-01-21 14:44:24 +02:00
Ben Irvin 14fd433d38 fix(database): only drop indexes that exist; do not drop on create (#22633)
* fix(database): verify existance on drop but do not drop on create

* revert: keep mysql conditional
2025-01-14 16:44:14 +01:00
Ben Irvin 8f227a605a fix: name must be initialized 2024-12-17 14:51:17 +01:00
Ben Irvin d4d5d39c55 Merge branch 'fix/db-sync-fk' of https://github.com/strapi/strapi into fix/db-sync-fk 2024-12-16 17:19:38 +01:00
Ben Irvin d8be3e0366 Merge branch 'develop' into fix/db-sync-fk 2024-12-16 16:44:39 +01:00
Ben Irvin 575be3afd4 enhancement(database): add repair manager with component deletion fix (#22267) 2024-12-16 12:56:05 +01:00
Ben Irvin f47bf90b3f chore: add header comment 2024-12-16 10:30:00 +01:00
Ben Irvin cfda358b7f chore: refactor 2024-12-16 09:41:08 +01:00
Ben Irvin 6a649cd9b7 revert: reimplement fix for mysql fks 2024-12-16 09:40:09 +01:00
Ben Irvin 27465bf4d7 fix: check indexes before transaction 2024-12-13 18:33:47 +01:00
Ben Irvin e350eaa607 chore: fix comment 2024-12-13 14:20:58 +01:00
Ben Irvin 4378a7852d fix(database): delete indexes before creating if they already exist 2024-12-13 14:03:45 +01:00
Convly 7bc5339b03 fix: adjust polymorphic relation encoding and index mapping 2024-12-10 11:33:02 +01:00
Nikolay Shebanov faf42a9ea1 fix: resolve naming conflict in the v5 document_id migration (#22140) 2024-11-20 12:22:10 +01:00
Ben Irvin 403e03f1ae enhancement: add db info to startup logger (#21876) 2024-11-20 12:18:25 +01:00
Marvin Mottet 9e6d64696b fix: possible query ambiguity during Strapi v5 db migration (#21596)
In the migration 5.0.0-02-created-document-id, the GROUP BY in the SQL request does not precise the column's table which create an ambiguity when a content type use internationalization and one of its field is named "[name_of_the_type]Id".

Co-authored-by: Jamie Howard <48524071+jhoward1994@users.noreply.github.com>
2024-11-08 14:51:20 +00:00
Ben Irvin f3ad685d4b feat: reordering for polymorphic relations in Content API (#21928)
Co-authored-by: Marc Roig <Marc-Roig@users.noreply.github.com>
Co-authored-by: Marc <marc.roig.campos@strapi.io>
2024-11-08 09:07:22 +01:00
Ben Irvin 14882e7940 enhancement(db): allow connection to be a function (#21573)
Thanks to @evan-thinksync and @fardarter for their contributions
2024-10-24 17:05:47 +02:00
Marc Roig c823b10e98 fix: search by numeric numbers in a relation (#21873) 2024-10-16 13:19:38 +02:00
Marc Roig d6fc84a403 fix: loading relations without DP fails after migrating to v5 (#21501)
* fix: loading entries without DP

* fix: time format

* fix: unit test

* fix: set published at with db query
2024-10-09 11:22:11 +02:00
Ben Irvin 006a21d394 fix: ignore order when checking index diff (#21576) 2024-10-04 15:11:11 +02:00
Ben Irvin 9bc666db2f Merge branch 'develop' into feature/add-mariadb-migration-support 2024-09-25 17:34:31 +02:00
Ben Irvin e43238abaf fix: drop and create columns and indexes in the correct order (#21402) 2024-09-24 12:52:57 +02:00
Ben Irvin c82e67b7e4 Merge branch 'develop' into feature/add-mariadb-migration-support 2024-09-23 12:22:53 +02:00
Ben Irvin d9962a84d0 fix: escape raw queries (#21247) 2024-09-12 17:51:45 +02:00
Ben Irvin e823059ba8 fix: do not generate localizations links table (#21230) 2024-09-12 16:43:24 +02:00
Marc Roig 953f201d8f fix: publishing correctly updates creator fields (#21155)
* fix: publishing correctly updates creator fields

* chore: pr suggestions

* fix: null values

* fix: test

* feat: ignore non visible fields
2024-09-09 11:13:36 +02:00
Alexandre Bodin 0c56eedb8f enhancement: poc localization field 2024-09-06 15:44:46 +02:00
Alexandre Bodin 09532e1266 chore: update test 2024-09-02 14:53:33 +02:00
Alexandre Bodin f5fba2b631 fix: reproduce v4 behavior for data compatibility 2024-09-02 13:46:35 +02:00
Ben Irvin 860584b10c chore: fix mismatched prettier versions (#21071) 2024-08-26 15:03:45 +02:00
Marc Roig 9c9ad857af fix: v5 migration does not link locales (#21050)
* chore: avoid using identifiers utils

* Update packages/core/database/src/migrations/internal-migrations/5.0.0-02-document-id.ts

Co-authored-by: Ben Irvin <ben.irvin@strapi.io>

* fix: prettier

---------

Co-authored-by: Ben Irvin <ben.irvin@strapi.io>
2024-08-23 10:10:52 +02:00