feat(db): setup drizzle config, client and package scripts
- Add drizzle.config.ts with PostgreSQL dialect configuration - Create lib/db/index.ts with Drizzle ORM client and pg Pool - Add db:generate, db:migrate, db:studio, db:push scripts to package.json Part of Chunk 1: Drizzle Config & DB Client setup
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
import { defineConfig } from "drizzle-kit"
|
||||
|
||||
export default defineConfig({
|
||||
schema: "./lib/db/schema/",
|
||||
out: "./drizzle/",
|
||||
dialect: "postgresql",
|
||||
dbCredentials: {
|
||||
url: process.env.DATABASE_URL!,
|
||||
},
|
||||
})
|
||||
@@ -0,0 +1,9 @@
|
||||
import { drizzle } from "drizzle-orm/node-postgres"
|
||||
import { Pool } from "pg"
|
||||
import * as schema from "./schema"
|
||||
|
||||
const pool = new Pool({
|
||||
connectionString: process.env.DATABASE_URL,
|
||||
})
|
||||
|
||||
export const db = drizzle(pool, { schema })
|
||||
+7
-1
@@ -6,10 +6,15 @@
|
||||
"dev": "next dev --experimental-https",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
"lint": "eslint"
|
||||
"lint": "eslint",
|
||||
"db:generate": "drizzle-kit generate",
|
||||
"db:migrate": "drizzle-kit migrate",
|
||||
"db:studio": "drizzle-kit studio",
|
||||
"db:push": "drizzle-kit push"
|
||||
},
|
||||
"dependencies": {
|
||||
"@aws-sdk/client-s3": "^3.1036.0",
|
||||
"@better-auth/drizzle-adapter": "^1.6.9",
|
||||
"@elysia/eden": "^1.4.10",
|
||||
"@tiptap/core": "^3.22.4",
|
||||
"@tiptap/pm": "^3.22.4",
|
||||
@@ -18,6 +23,7 @@
|
||||
"better-auth": "^1.6.9",
|
||||
"dotenv": "^17.4.2",
|
||||
"drizzle-orm": "^0.45.2",
|
||||
"echarts": "^6.0.0",
|
||||
"elysia": "^1.4.28",
|
||||
"lucide-react": "^1.11.0",
|
||||
"motion": "^12.38.0",
|
||||
|
||||
Reference in New Issue
Block a user