@payloadcms/plugin-cloud
Advanced tools
Changelog
2.1.1 (2023-11-10)
Changelog
2.1.0 (2023-11-08)
Changelog
2.0.0 (2023-10-09)
rtl
, human-friendly labels, etc.tsconfig
path
pointing to your generated Payload types is no longer required for types to workHere's an example of a barebones Payload config, set up to work as 1.0 did:
import { mongooseAdapter } from "@payloadcms/db-mongodb";
import { slateEditor } from "@payloadcms/richtext-slate";
import { webpackBundler } from "@payloadcms/bundler-webpack";
import { buildConfig } from "payload/config";
export default buildConfig({
admin: {
bundler: webpackBundler(),
},
editor: slateEditor({}),
collections: [
// your collections here
],
db: mongooseAdapter({
url: process.env.DATABASE_URI,
}),
});
These new properties are all now required for Payload to function, and you will have to install each separate adapter that you use. Feel free to swap out any of the adapters with your choice (Lexical, Postgres, Vite, etc.)
Make sure to install the packages that you need. In the above example, you would need to install the following:
npm install --save @payloadcms/db-mongodb @payloadcms/richtext-slate @payloadcms/bundler-webpack
latest: true
property to be set on the most recent draft in your _versions
collections(s)We have a ready-to-go migration script for your versions from v1 to v2, and to use it, all you have to do is run the following commands:
1. First, make sure you have a payload
npm script in your package.json
{
"scripts": {
"payload": "cross-env PAYLOAD_CONFIG_PATH=src/payload.config.ts payload"
}
}
Adjust the PAYLOAD_CONFIG_PATH
to point to your Payload config file if necessary.
2. Create a migration, using the new Payload migration API
npm run payload migrate:create --file @payloadcms/db-mongodb/versions-v1-v2
The above command will output a migration file into your ./src/migrations
folder (default migrations location). It contains a migration script to automatically add a latest: true
flag to each of your newest drafts, for all draft-enabled collections. It works out of the box!
3. Run migrations
From there, you need to run migrations. Run the following command to execute your new migration:
npm run payload migrate
And you'll be all good!