Okay (hello @tidal kayak ) I have my all app build with Supabase. But I wanna something very "modular" so being stuck on Supabase isnt a good idea, that why I wnana switch with a default postgres database, so I need an ORM and NextAuth. Well lets try Drizzle (Prisma sound good too but many people say that Drizzle is more future proof). Firstly, Ive setup my Drizzle schema. I have 3 files inside @/db/schema/ :
- index.ts
- auth.ts
- public.ts
My idea is to have a seperate schema only for auth table (like Supabase does and allows me to keep seperate sensible data like password etc...). So the index.ts file only concatenate the two schema like this :
import * as publicSchema from '@/db/schema/public'
const schema = {
...authSchema,
...publicSchema,
}
export default schema;```
Ive setup my "db" like this (ive previously try to setup with Neon but got TS error without any fancy stuff just the official docs ahah) :
```import { drizzle } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import schema from '@/db/schema'
const connectionString = String(process.env.DATABASE_URL)
const client = postgres(connectionString)
export const db = drizzle(client, { schema });```