@@ -2457,6 +2457,7 @@ for (const dialect of DIALECTS) {
24572457 if ( sqlSpec === 'postgres' ) {
24582458 it ( 'should drop a schema cascade' , async ( ) => {
24592459 await ctx . db . schema . createSchema ( 'pets' ) . execute ( )
2460+
24602461 const builder = ctx . db . schema . dropSchema ( 'pets' ) . cascade ( )
24612462
24622463 testSql ( builder , dialect , {
@@ -2561,10 +2562,68 @@ for (const dialect of DIALECTS) {
25612562
25622563 await builder . execute ( )
25632564 } )
2565+
2566+ it ( 'should drop multiple types' , async ( ) => {
2567+ await ctx . db . schema . createType ( 'species' ) . execute ( )
2568+ await ctx . db . schema . createType ( 'colors' ) . execute ( )
2569+
2570+ const builder = ctx . db . schema
2571+ . dropType ( [ 'species' , 'colors' ] )
2572+ . ifExists ( )
2573+
2574+ testSql ( builder , dialect , {
2575+ postgres : {
2576+ sql : `drop type if exists "species", "colors"` ,
2577+ parameters : [ ] ,
2578+ } ,
2579+ mysql : NOT_SUPPORTED ,
2580+ mssql : NOT_SUPPORTED ,
2581+ sqlite : NOT_SUPPORTED ,
2582+ } )
2583+
2584+ await builder . execute ( )
2585+ } )
2586+
2587+ it ( 'should drop multiple types if exists' , async ( ) => {
2588+ await ctx . db . schema . createType ( 'species' ) . execute ( )
2589+ const builder = ctx . db . schema
2590+ . dropType ( [ 'species' , 'colors' ] )
2591+ . ifExists ( )
2592+
2593+ testSql ( builder , dialect , {
2594+ postgres : {
2595+ sql : `drop type if exists "species", "colors"` ,
2596+ parameters : [ ] ,
2597+ } ,
2598+ mysql : NOT_SUPPORTED ,
2599+ mssql : NOT_SUPPORTED ,
2600+ sqlite : NOT_SUPPORTED ,
2601+ } )
2602+
2603+ await builder . execute ( )
2604+ } )
2605+
2606+ it ( 'should drop a type and cascade' , async ( ) => {
2607+ await ctx . db . schema . createType ( 'species' ) . execute ( )
2608+
2609+ const builder = ctx . db . schema . dropType ( 'species' ) . cascade ( )
2610+
2611+ testSql ( builder , dialect , {
2612+ postgres : {
2613+ sql : `drop type "species" cascade` ,
2614+ parameters : [ ] ,
2615+ } ,
2616+ mysql : NOT_SUPPORTED ,
2617+ mssql : NOT_SUPPORTED ,
2618+ sqlite : NOT_SUPPORTED ,
2619+ } )
2620+
2621+ await builder . execute ( )
2622+ } )
25642623 }
25652624
25662625 async function cleanup ( ) {
2567- await ctx . db . schema . dropType ( 'species' ) . ifExists ( ) . execute ( )
2626+ await ctx . db . schema . dropType ( [ 'species' , 'colors' ] ) . ifExists ( ) . execute ( )
25682627 }
25692628 } )
25702629
0 commit comments