@@ -279,6 +279,7 @@ const singlestoreSuite: DialectSuite = {
279279 await context . client . query ( st ) ;
280280 }
281281 } ,
282+ // TODO non-vector indexes
282283 addBasicIndexes : async function ( context ?: any ) : Promise < void > {
283284 const schema1 = {
284285 vectorIndex : singlestoreTable ( 'vector_table' , {
@@ -329,7 +330,48 @@ const singlestoreSuite: DialectSuite = {
329330 await context . client . query ( st ) ;
330331 }
331332 } ,
332- changeIndexFields : function ( context ?: any ) : Promise < void > {
333+ changeIndexFields : async function ( context ?: any ) : Promise < void > {
334+ const schema1 = {
335+ vectorIndex : singlestoreTable ( 'vector_table' , {
336+ v : vector ( 'v' , { dimensions : 10 } ) ,
337+ } , ( table ) => [
338+ vectorIndex ( 'vector_index' ) . on ( table . v ) ,
339+ ] ) ,
340+ } ;
341+
342+ const schema2 = {
343+ vectorIndex : singlestoreTable ( 'vector_table' , {
344+ v : vector ( 'v' , { dimensions : 10 } ) ,
345+ } , ( table ) => [
346+ vectorIndex ( 'vector_index' , 'IVF_PQ' ) . on ( table . v ) . metricType ( 'EUCLIDEAN_DISTANCE' ) . nbits ( 16 ) ,
347+ ] ) ,
348+ } ;
349+
350+ const { statements, sqlStatements } = await diffTestSchemasPushSingleStore (
351+ context . client as Connection ,
352+ schema1 ,
353+ schema2 ,
354+ [ ] ,
355+ 'drizzle' ,
356+ false ,
357+ ) ;
358+ expect ( statements . length ) . toBe ( 2 ) ;
359+ expect ( sqlStatements ) . toStrictEqual ( [
360+ `DROP INDEX \`vector_index\` ON \`vector_table\`;` ,
361+ `ALTER TABLE \`vector_table\` ADD VECTOR INDEX \`vector_index\` (\`v\`) INDEX_OPTIONS '{"index_type":"IVF_PQ","metric_type":"EUCLIDEAN_DISTANCE","nbits":16}';` ,
362+ ] ) ;
363+
364+ const { sqlStatements : dropStatements } = await diffTestSchemasSingleStore (
365+ schema2 ,
366+ { } ,
367+ [ ] ,
368+ false ,
369+ ) ;
370+
371+ for ( const st of dropStatements ) {
372+ await context . client . query ( st ) ;
373+ }
374+
333375 return { } as any ;
334376 } ,
335377 dropIndex : async function ( context ?: any ) : Promise < void > {
@@ -355,9 +397,16 @@ const singlestoreSuite: DialectSuite = {
355397 'drizzle' ,
356398 false ,
357399 ) ;
358- console . log ( statements ) ;
359- console . log ( sqlStatements ) ;
360400 expect ( statements . length ) . toBe ( 1 ) ;
401+ expect ( statements [ 0 ] ) . toStrictEqual ( {
402+ type : 'drop_index' ,
403+ tableName : 'vector_table' ,
404+ data : 'vector_index;v;AUTO;;;;;;;;' ,
405+ schema : '' ,
406+ } ) ;
407+ expect ( sqlStatements [ 0 ] ) . toBe (
408+ `DROP INDEX \`vector_index\` ON \`vector_table\`;` ,
409+ ) ;
361410
362411 const { sqlStatements : dropStatements } = await diffTestSchemasSingleStore (
363412 schema2 ,
0 commit comments