-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(svelte-ui): add
drizzle
ORM for db access
I'll be trying Drizzle cause it looks interesting and it's one of the recommended tools when initializing a new SvelteKit project. For now, I'll just use my existing Prisma schema and use a database-first approach with `drizzle pull`. Ref: https://orm.drizzle.team/docs/overview Ref: https://orm.drizzle.team/docs/migrations
- Loading branch information
1 parent
e50c08f
commit de25465
Showing
7 changed files
with
682 additions
and
2 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 @@ | ||
DATABASE_URL="postgres://root:mysecretpassword@localhost:5432/local" |
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,10 @@ | ||
services: | ||
db: | ||
image: postgres | ||
restart: always | ||
ports: | ||
- 5432:5432 | ||
environment: | ||
POSTGRES_USER: root | ||
POSTGRES_PASSWORD: mysecretpassword | ||
POSTGRES_DB: local |
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,14 @@ | ||
import { defineConfig } from 'drizzle-kit'; | ||
if (!process.env.DATABASE_URL) throw new Error('DATABASE_URL is not set'); | ||
|
||
export default defineConfig({ | ||
schema: './src/lib/server/db/schema.ts', | ||
|
||
dbCredentials: { | ||
url: process.env.DATABASE_URL | ||
}, | ||
|
||
verbose: true, | ||
strict: true, | ||
dialect: 'postgresql' | ||
}); |
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
Oops, something went wrong.