@@ -90,10 +90,9 @@ export async function checkForLargeIndexDeletion({
9090 } ) ,
9191 ) ;
9292
93- const minDocumentsForWarning = minDocumentsForIndexDeleteWarning ( ) ;
9493 if (
9594 ! deletedIndexesWithDocumentsCount . some (
96- ( { count } ) => count >= minDocumentsForWarning ,
95+ ( { count } ) => count >= MIN_DOCUMENTS_FOR_INDEX_DELETE_WARNING ,
9796 )
9897 ) {
9998 logFinishedStep ( "No large indexes are deleted by this push" ) ;
@@ -105,13 +104,12 @@ from your production deployment (${options.url}):
105104
106105${ deletedIndexesWithDocumentsCount
107106 . map ( ( { componentDefinitionPath, index, count } ) =>
108- formatDeletedIndex ( {
107+ formatDeletedIndex (
109108 componentDefinitionPath ,
110109 index ,
111- indexDiff : indexDiffs [ componentDefinitionPath ] ,
112- documentsCount : count ,
113- minDocumentsForWarning,
114- } ) ,
110+ indexDiffs [ componentDefinitionPath ] ,
111+ count ,
112+ ) ,
115113 )
116114 . join ( "\n" ) }
117115
@@ -153,26 +151,19 @@ to be backfilled again if you want to restore it later.
153151 logFinishedStep ( "Proceeding with push." ) ;
154152}
155153
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- } ) {
154+ function formatDeletedIndex (
155+ componentDefinitionPath : string ,
156+ index : DeveloperIndexConfig ,
157+ indexDiff : IndexDiff ,
158+ documentsCount : number ,
159+ ) {
169160 const componentNameFormatted =
170161 componentDefinitionPath !== ""
171162 ? `${ chalk . gray ( componentDefinitionPath ) } :`
172163 : "" ;
173164
174165 const documentsCountFormatted =
175- documentsCount >= minDocumentsForWarning
166+ documentsCount >= MIN_DOCUMENTS_FOR_INDEX_DELETE_WARNING
176167 ? ` ${ chalk . yellowBright ( `⚠️ ${ documentsCount . toLocaleString ( ) } documents` ) } `
177168 : ` ${ documentsCount . toLocaleString ( ) } ${ documentsCount === 1 ? "document" : "documents" } ` ;
178169
@@ -194,14 +185,3 @@ function getTableName(index: DeveloperIndexConfig) {
194185 const [ tableName , _indexName ] = index . name . split ( "." ) ;
195186 return tableName ;
196187}
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