@@ -2482,6 +2482,7 @@ for (const dialect of DIALECTS) {
24822482 if ( sqlSpec === 'postgres' ) {
24832483 it ( 'should drop a schema cascade' , async ( ) => {
24842484 await ctx . db . schema . createSchema ( 'pets' ) . execute ( )
2485+
24852486 const builder = ctx . db . schema . dropSchema ( 'pets' ) . cascade ( )
24862487
24872488 testSql ( builder , dialect , {
@@ -2586,10 +2587,68 @@ for (const dialect of DIALECTS) {
25862587
25872588 await builder . execute ( )
25882589 } )
2590+
2591+ it ( 'should drop multiple types' , async ( ) => {
2592+ await ctx . db . schema . createType ( 'species' ) . execute ( )
2593+ await ctx . db . schema . createType ( 'colors' ) . execute ( )
2594+
2595+ const builder = ctx . db . schema
2596+ . dropType ( [ 'species' , 'colors' ] )
2597+ . ifExists ( )
2598+
2599+ testSql ( builder , dialect , {
2600+ postgres : {
2601+ sql : `drop type if exists "species", "colors"` ,
2602+ parameters : [ ] ,
2603+ } ,
2604+ mysql : NOT_SUPPORTED ,
2605+ mssql : NOT_SUPPORTED ,
2606+ sqlite : NOT_SUPPORTED ,
2607+ } )
2608+
2609+ await builder . execute ( )
2610+ } )
2611+
2612+ it ( 'should drop multiple types if exists' , async ( ) => {
2613+ await ctx . db . schema . createType ( 'species' ) . execute ( )
2614+ const builder = ctx . db . schema
2615+ . dropType ( [ 'species' , 'colors' ] )
2616+ . ifExists ( )
2617+
2618+ testSql ( builder , dialect , {
2619+ postgres : {
2620+ sql : `drop type if exists "species", "colors"` ,
2621+ parameters : [ ] ,
2622+ } ,
2623+ mysql : NOT_SUPPORTED ,
2624+ mssql : NOT_SUPPORTED ,
2625+ sqlite : NOT_SUPPORTED ,
2626+ } )
2627+
2628+ await builder . execute ( )
2629+ } )
2630+
2631+ it ( 'should drop a type and cascade' , async ( ) => {
2632+ await ctx . db . schema . createType ( 'species' ) . execute ( )
2633+
2634+ const builder = ctx . db . schema . dropType ( 'species' ) . cascade ( )
2635+
2636+ testSql ( builder , dialect , {
2637+ postgres : {
2638+ sql : `drop type "species" cascade` ,
2639+ parameters : [ ] ,
2640+ } ,
2641+ mysql : NOT_SUPPORTED ,
2642+ mssql : NOT_SUPPORTED ,
2643+ sqlite : NOT_SUPPORTED ,
2644+ } )
2645+
2646+ await builder . execute ( )
2647+ } )
25892648 }
25902649
25912650 async function cleanup ( ) {
2592- await ctx . db . schema . dropType ( 'species' ) . ifExists ( ) . execute ( )
2651+ await ctx . db . schema . dropType ( [ 'species' , 'colors' ] ) . ifExists ( ) . execute ( )
25932652 }
25942653 } )
25952654
0 commit comments