Skip to content

Commit

Permalink
feat(nuxt): drizzle query schema support
Browse files Browse the repository at this point in the history
  • Loading branch information
productdevbook committed Jan 22, 2024
1 parent 97ea85d commit dc72c49
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 9 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ coverage
lib
dist
.nx
.eslintcache
.eslintcache
pergel
1 change: 1 addition & 0 deletions packages/nuxt/playground/pergel/.env.template
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ NUXT_TEST_DRIZZLE_PG_PASSWORD=postgres
NUXT_TEST_DRIZZLE_PG_SSL=false
NUXT_TEST_DRIZZLE_PG_DROP=false
NUXT_TEST_DRIZZLE_PG_SEED=false
NUXT_TEST_DRIZZLE_PG_MIGRATE=false

# test/bullmq
NUXT_TEST_BULLMQ_OPTIONS_HOST=localhost
Expand Down
5 changes: 3 additions & 2 deletions packages/nuxt/playground/pergel/README.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"pergel": {
"comment-block-1": "This file is generated by pergel. Do not edit it manually.",
"comment-block-2": "Version: 0.7.14"
"comment-block-2": "Version: 0.7.17"
},
"test": {
"lucia": {
Expand Down Expand Up @@ -45,7 +45,8 @@
"NUXT_TEST_DRIZZLE_PG_PASSWORD": "postgres",
"NUXT_TEST_DRIZZLE_PG_SSL": false,
"NUXT_TEST_DRIZZLE_PG_DROP": false,
"NUXT_TEST_DRIZZLE_PG_SEED": false
"NUXT_TEST_DRIZZLE_PG_SEED": false,
"NUXT_TEST_DRIZZLE_PG_MIGRATE": false
},
"packageJson": {
"dependencies": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export async function connectPostgresJS(this: PergelGlobalContextOmitModule, ctx
options?: PostgresJSOptions
event?: H3Event
pergel?: PergelGlobalContextOmitModule
config?: Parameters<typeof drizzle>[1]
}) {
const _pergel = ctx.pergel ?? this

Expand All @@ -21,13 +22,13 @@ export async function connectPostgresJS(this: PergelGlobalContextOmitModule, ctx

const { client } = await clientInit(_pergel, (runtime) => {
if (runtime.url)
return drizzle(postgres(runtime.url, {}))
return drizzle(postgres(runtime.url, {}), ctx.config)

else if (process.env.POSTGRES_URL)
return drizzle(postgres(process.env.POSTGRES_URL, ctx.options?.options))
return drizzle(postgres(process.env.POSTGRES_URL, ctx.options?.options), ctx.config)

else if (ctx.options?.options)
return drizzle(postgres(ctx.options.options))
return drizzle(postgres(ctx.options.options), ctx.config)

else
throw new Error('PostgresJS is not defined')
Expand Down
5 changes: 3 additions & 2 deletions themes/pergel-auth/pergel/README.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"pergel": {
"comment-block-1": "This file is generated by pergel. Do not edit it manually.",
"comment-block-2": "Version: 0.7.14"
"comment-block-2": "Version: 0.7.17"
},
"changeName": {
"lucia": {
Expand Down Expand Up @@ -45,7 +45,8 @@
"NUXT_CHANGE_NAME_DRIZZLE_PG_PASSWORD": "postgres",
"NUXT_CHANGE_NAME_DRIZZLE_PG_SSL": false,
"NUXT_CHANGE_NAME_DRIZZLE_PG_DROP": false,
"NUXT_CHANGE_NAME_DRIZZLE_PG_SEED": false
"NUXT_CHANGE_NAME_DRIZZLE_PG_SEED": false,
"NUXT_CHANGE_NAME_DRIZZLE_PG_MIGRATE": false
},
"packageJson": {
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion themes/pergel-ionic/pergel/README.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"pergel": {
"comment-block-1": "This file is generated by pergel. Do not edit it manually.",
"comment-block-2": "Version: 0.7.14"
"comment-block-2": "Version: 0.7.17"
},
"changeName": {
"box": {
Expand Down

0 comments on commit dc72c49

Please sign in to comment.