@@ -90,9 +90,10 @@ export async function checkForLargeIndexDeletion({
9090 } ) ,
9191 ) ;
9292
93+ const minDocumentsForWarning = minDocumentsForIndexDeleteWarning ( ) ;
9394 if (
9495 ! deletedIndexesWithDocumentsCount . some (
95- ( { count } ) => count >= MIN_DOCUMENTS_FOR_INDEX_DELETE_WARNING ,
96+ ( { count } ) => count >= minDocumentsForWarning ,
9697 )
9798 ) {
9899 logFinishedStep ( "No large indexes are deleted by this push" ) ;
@@ -104,12 +105,13 @@ from your production deployment (${options.url}):
104105
105106${ deletedIndexesWithDocumentsCount
106107 . map ( ( { componentDefinitionPath, index, count } ) =>
107- formatDeletedIndex (
108+ formatDeletedIndex ( {
108109 componentDefinitionPath,
109110 index,
110- indexDiffs [ componentDefinitionPath ] ,
111- count ,
112- ) ,
111+ indexDiff : indexDiffs [ componentDefinitionPath ] ,
112+ documentsCount : count ,
113+ minDocumentsForWarning,
114+ } ) ,
113115 )
114116 . join ( "\n" ) }
115117
@@ -151,19 +153,26 @@ to be backfilled again if you want to restore it later.
151153 logFinishedStep ( "Proceeding with push." ) ;
152154}
153155
154- function formatDeletedIndex (
155- componentDefinitionPath : string ,
156- index : DeveloperIndexConfig ,
157- indexDiff : IndexDiff ,
158- documentsCount : number ,
159- ) {
156+ function formatDeletedIndex ( {
157+ componentDefinitionPath,
158+ index,
159+ indexDiff,
160+ documentsCount,
161+ minDocumentsForWarning,
162+ } : {
163+ componentDefinitionPath : string ;
164+ index : DeveloperIndexConfig ;
165+ indexDiff : IndexDiff ;
166+ documentsCount : number ;
167+ minDocumentsForWarning : number ;
168+ } ) {
160169 const componentNameFormatted =
161170 componentDefinitionPath !== ""
162171 ? `${ chalk . gray ( componentDefinitionPath ) } :`
163172 : "" ;
164173
165174 const documentsCountFormatted =
166- documentsCount >= MIN_DOCUMENTS_FOR_INDEX_DELETE_WARNING
175+ documentsCount >= minDocumentsForWarning
167176 ? ` ${ chalk . yellowBright ( `⚠️ ${ documentsCount . toLocaleString ( ) } documents` ) } `
168177 : ` ${ documentsCount . toLocaleString ( ) } ${ documentsCount === 1 ? "document" : "documents" } ` ;
169178
@@ -185,3 +194,14 @@ function getTableName(index: DeveloperIndexConfig) {
185194 const [ tableName , _indexName ] = index . name . split ( "." ) ;
186195 return tableName ;
187196}
197+
198+ function minDocumentsForIndexDeleteWarning ( ) : number {
199+ const envValue = process . env . CONVEX_MIN_DOCUMENTS_FOR_INDEX_DELETE_WARNING ;
200+ if ( envValue !== undefined ) {
201+ const parsed = parseInt ( envValue , 10 ) ;
202+ if ( ! isNaN ( parsed ) ) {
203+ return parsed ;
204+ }
205+ }
206+ return MIN_DOCUMENTS_FOR_INDEX_DELETE_WARNING ;
207+ }
0 commit comments