2.28.0 (2024-09-04)
Features
- collections can use custom database operations (#7675) (6ba293c) (@kendelljoseph)
Tag Name: v2.28.0
Release Date: 9/4/2024
Payload CMSPayload CMS is a modern, self-hosted headless content management system built with TypeScript, Node.js, and MongoDB. It's designed specifically for developers who want full control over their content management system while maintaining a powerful admin interface for content editors.
This release doesn't contain breaking changes, making it straightforward to upgrade from v2.27.0.
npm install [email protected]
# or
yarn add [email protected]
# or
pnpm add [email protected]
If using PostgreSQL:
If using the cloud plugin:
To use the new custom database operations feature:
Issue Template Updates:
payload info command now uses a textareaRecommendation: Standard Upgrade
This release is recommended for all Payload CMS users, especially those using PostgreSQL or the cloud plugin.
The release contains no breaking changes, making it a safe upgrade from v2.27.0. The improvements to PostgreSQL functionality and the addition of custom database operations provide significant value with minimal upgrade risk.
For projects with critical PostgreSQL functionality or those requiring custom database handling, this upgrade should be prioritized.
Fixed Migration Exit Codes (#7873)
Improved Query Handling for hasMany Relationships (#8033)
Payload CMS now allows developers to override default database operations for collections. This powerful feature gives you complete control over how your collection interacts with the database.
You can now customize the following operations:
createdeleteManydeleteOnefindfindOneupdateOneExample usage:
import { CollectionConfig } from 'payload/types';
export const Collection: CollectionConfig = {
slug: 'example-collection',
// Database operations for this collection
db: {
create: () => {},
deleteMany: () => {},
deleteOne: () => {},
find: () => {},
findOne: () => {},
updateOne: () => {}
},
fields: [
{
name: 'someField',
type: 'text',
},
],
}
This feature enables advanced use cases such as:
No specific security fixes were included in this release.
While this release doesn't explicitly focus on performance enhancements, several changes contribute to improved system performance:
Custom Database Operations
PostgreSQL Query Handling
Migration Process Improvements
Payload CMS v2.28.0 delivers a significant enhancement to the database layer by introducing custom database operations for collections. This feature fundamentally changes how developers can interact with the database, providing unprecedented flexibility to override default behaviors for create, read, update, and delete operations.
The PostgreSQL fixes address important issues that could affect system reliability. The migration exit code fix ensures that CI/CD pipelines correctly interpret the success or failure of database migrations, preventing potential deployment issues. The query handling improvements for hasMany relationships ensure consistent and correct data retrieval in complex data structures.
For cloud plugin users, the improved logging on static handlers enhances observability and makes troubleshooting easier, which is particularly valuable in production environments.
Overall, this release balances new capabilities with important fixes, making it a valuable upgrade for most Payload CMS implementations. The custom database operations feature opens up new possibilities for advanced use cases, while the bug fixes ensure more reliable operation, particularly for PostgreSQL users.