-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migration to drizzle to support cloudflare worker officially
- Loading branch information
1 parent
b9b4e89
commit d28ed10
Showing
51 changed files
with
2,341 additions
and
512 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import type { Config } from 'drizzle-kit'; | ||
|
||
export default { | ||
schema: './server/db/schema.ts', | ||
out: './server/db/drizzle', | ||
driver: 'turso', | ||
dbCredentials: { | ||
url: process.env.DB_URL!, | ||
authToken: process.env.DB_AUTH_TOKEN!, | ||
}, | ||
} satisfies Config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,12 @@ | ||
import { organizationsPeople } from "../db/schema" | ||
|
||
export default defineEventHandler(async ({ context }) => { | ||
const userId = context.auth.userId | ||
const org = await context.prisma.organizations.findFirstOrThrow() | ||
await context.prisma.organizationsPeople.create({ | ||
data: { | ||
organizationId: org.id, | ||
userId: userId, | ||
}, | ||
const db = context.drizzle | ||
const org = await db.query.organizations.findFirst() | ||
await db.insert(organizationsPeople).values({ | ||
organizationId: org!.id, | ||
userId: userId, | ||
}) | ||
return {} | ||
}) |
Oops, something went wrong.