File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
packages/payload/src/config Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -395,15 +395,24 @@ export const sanitizeConfig = async (incomingConfig: Config): Promise<SanitizedC
395395 ) ,
396396 )
397397
398- configWithDefaults . collections ! . push (
399- await sanitizeCollection (
400- config as unknown as Config ,
401- migrationsCollection ,
402- richTextSanitizationPromises ,
403- validRelationships ,
404- ) ,
398+ const migrations = await sanitizeCollection (
399+ config as unknown as Config ,
400+ migrationsCollection ,
401+ richTextSanitizationPromises ,
402+ validRelationships ,
405403 )
406404
405+ // @ts -expect-error indexSortableFields is only valid for @payloadcms/db-mongodb
406+ if ( config ?. db ?. indexSortableFields ) {
407+ migrations . indexes = [
408+ {
409+ fields : [ 'batch' , 'name' ] ,
410+ unique : false ,
411+ } ,
412+ ]
413+ }
414+ configWithDefaults . collections ! . push ( migrations )
415+
407416 if ( queryPresetsCollections . length > 0 ) {
408417 configWithDefaults . collections ! . push (
409418 await sanitizeCollection (
You can’t perform that action at this time.
0 commit comments