@@ -37,10 +37,7 @@ export const seed = async ({
37
37
// as well as the collections and globals
38
38
// this is because while `yarn seed` drops the database
39
39
// the custom `/api/seed` endpoint does not
40
-
41
- payload . logger . info ( `— Clearing media...` )
42
40
payload . logger . info ( `— Clearing collections and globals...` )
43
-
44
41
// clear the database
45
42
await Promise . all (
46
43
globals . map ( ( global ) =>
@@ -57,31 +54,16 @@ export const seed = async ({
57
54
) ,
58
55
)
59
56
60
- await Promise . all (
61
- collections . map ( ( collection ) =>
62
- payload . delete ( {
63
- collection : collection ,
64
- where : {
65
- id : {
66
- exists : true ,
67
- } ,
68
- } ,
69
- depth : 0 ,
70
- context : {
71
- disableRevalidate : true ,
72
- } ,
73
- } ) ,
74
- ) ,
75
- )
76
-
77
- const pages = await payload . delete ( {
78
- collection : 'pages' ,
79
- where : { } ,
80
- context : {
81
- disableRevalidate : true ,
82
- } ,
83
- depth : 0 ,
84
- } )
57
+ for ( const collection of collections ) {
58
+ await payload . delete ( {
59
+ collection : collection ,
60
+ where : { } ,
61
+ depth : 0 ,
62
+ context : {
63
+ disableRevalidate : true ,
64
+ } ,
65
+ } )
66
+ }
85
67
86
68
payload . logger . info ( `— Seeding demo author and user...` )
87
69
@@ -217,7 +199,6 @@ export const seed = async ({
217
199
context : {
218
200
disableRevalidate : true ,
219
201
} ,
220
- select : { content : false } ,
221
202
data : JSON . parse (
222
203
JSON . stringify ( { ...post1 , categories : [ technologyCategory . id ] } )
223
204
. replace ( / " \{ \{ I M A G E _ 1 \} \} " / g, String ( image1ID ) )
@@ -232,7 +213,6 @@ export const seed = async ({
232
213
context : {
233
214
disableRevalidate : true ,
234
215
} ,
235
- select : { content : false } ,
236
216
data : JSON . parse (
237
217
JSON . stringify ( { ...post2 , categories : [ newsCategory . id ] } )
238
218
. replace ( / " \{ \{ I M A G E _ 1 \} \} " / g, String ( image2ID ) )
@@ -247,7 +227,6 @@ export const seed = async ({
247
227
context : {
248
228
disableRevalidate : true ,
249
229
} ,
250
- select : { content : false } ,
251
230
data : JSON . parse (
252
231
JSON . stringify ( { ...post3 , categories : [ financeCategory . id ] } )
253
232
. replace ( / " \{ \{ I M A G E _ 1 \} \} " / g, String ( image3ID ) )
@@ -284,7 +263,6 @@ export const seed = async ({
284
263
const contactForm = await payload . create ( {
285
264
collection : 'forms' ,
286
265
depth : 0 ,
287
- select : { title : true } ,
288
266
data : JSON . parse ( JSON . stringify ( contactFormData ) ) ,
289
267
} )
290
268
0 commit comments