Seed data plugin for PayloadCms.
A plugin that allows you to seed the initial data of one or more collections.
- Payload version 2.28.0 or higher is required.
npm i @websolutespa/payload-plugin-seed
import { buildConfig } from 'payload/config';
import { seed } from '@websolutespa/payload-plugin-seed';
export default buildConfig({
plugins: [
// ...
seed({
collections: {
label: () => [{
id: 'label',
value: 'Label',
}],
},
}),
],
});
Option | Type | Description |
---|---|---|
collections |
Record<string, () => SeedItem[]> |
a record with collection slugs as keys and functions that return seedItems as results. |
drop |
boolean | string[] |
drop all seeded collections or pass an array of collection slugs to drop. |
- allows you to seed the initial data of one or more collections.