Skip to content

Commit

Permalink
Merge branch 'main' into update-drizzle
Browse files Browse the repository at this point in the history
  • Loading branch information
mauriciabad authored Jun 11, 2024
2 parents 010c5ff + c0ae526 commit f76690c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
8 changes: 5 additions & 3 deletions src/server/api/router/admin/images.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@ export const imagesAdminRouter = router({
return await getAllImages.execute()
}),
getById: adminProcedure.input(getByIdSchema).query(async ({ input }) => {
return await getById.execute({
id: input.id,
})
return (
(await getById.execute({
id: input.id,
})) ?? null
)
}),
})
11 changes: 7 additions & 4 deletions src/server/db/db.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import 'server-only'
import { env } from '~/env.mjs'

import { neon } from '@neondatabase/serverless'
import { drizzle as drizzleNeon, NeonHttpDatabase } from 'drizzle-orm/neon-http'
import { Pool } from '@neondatabase/serverless'
import {
drizzle as drizzleNeon,
NeonDatabase,
} from 'drizzle-orm/neon-serverless'
import { drizzle as drizzlePg } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import * as schema from './schema'
Expand All @@ -13,5 +16,5 @@ export const db =
schema,
// TODO: Remove this unsafe type cast when this issue is fixed:
// https://github.com/drizzle-team/drizzle-orm/issues/1129
}) as unknown as NeonHttpDatabase<typeof schema>)
: drizzleNeon(neon(env.DATABASE_URL), { schema })
}) as unknown as NeonDatabase<typeof schema>)
: drizzleNeon(new Pool({ connectionString: env.DATABASE_URL }), { schema })

0 comments on commit f76690c

Please sign in to comment.