@@ -17,13 +17,11 @@ export default defineEventHandler(async event => {
1717 } ) ;
1818 }
1919
20- const deployment = await getFirst (
21- db
22- . select ( )
23- . from ( deploymentSchema )
24- . where ( and ( eq ( deploymentSchema . id , deploymentId ) , eq ( deploymentSchema . appId , app . id ) ) )
25- . execute ( ) ,
26- ) ;
20+ const deployment = await db
21+ . select ( )
22+ . from ( deploymentSchema )
23+ . where ( and ( eq ( deploymentSchema . id , deploymentId ) , eq ( deploymentSchema . appId , app . id ) ) )
24+ . get ( ) ;
2725 if ( ! deployment ) {
2826 throw createError ( {
2927 status : 404 ,
@@ -37,26 +35,24 @@ export default defineEventHandler(async event => {
3735 } )
3836 . parseAsync ( await readBody ( event ) ) ;
3937
40- const hasProductionDeployment = await getFirst (
41- db
42- . select ( )
43- . from ( deploymentSchema )
44- . where ( and ( eq ( deploymentSchema . appId , app . id ) , eq ( deploymentSchema . isProduction , 1 ) ) )
45- . execute ( ) ,
46- ) ;
38+ const hasProductionDeployment = await db
39+ . select ( )
40+ . from ( deploymentSchema )
41+ . where ( and ( eq ( deploymentSchema . appId , app . id ) , eq ( deploymentSchema . isProduction , true ) ) )
42+ . get ( ) ;
4743
4844 if ( input . isProduction && hasProductionDeployment ) {
4945 await db
5046 . update ( deploymentSchema )
51- . set ( { isProduction : 0 } )
47+ . set ( { isProduction : false } )
5248 . where ( eq ( deploymentSchema . appId , deployment . appId ) )
5349 . execute ( ) ;
5450 }
5551
5652 await db
5753 . update ( deploymentSchema )
5854 . set ( {
59- isProduction : ! hasProductionDeployment || input . isProduction ? 1 : 0 ,
55+ isProduction : ! hasProductionDeployment || input . isProduction ,
6056 } )
6157 . where ( eq ( deploymentSchema . id , deploymentId ) )
6258 . execute ( ) ;
@@ -75,7 +71,7 @@ export default defineEventHandler(async event => {
7571 cron : app . cron ,
7672 cronRegion : app . cronRegion ,
7773 env : envStringToObject ( env ) ,
78- isProduction : deployment . isProduction === 1 ,
74+ isProduction : deployment . isProduction ,
7975 assets : parseAssets ( deployment . assets ) ,
8076 } ) ;
8177
0 commit comments