need postgres explanation

do I have to start my own server for my postgres database with user and password and run in alongside my next app to be able to connect to it with
import * as courses from '@/db/schema/courses'
import * as studentsCourses from '@/db/schema/courses-students'
import * as users from '@/db/schema/users'
import { drizzle } from 'drizzle-orm/node-postgres'
import { Client } from 'pg'

const client = new Client({
connectionString: `postgres://user:password@host:port/db`,
})

export const db = drizzle(client, {
schema: {
...users,
...courses,
...studentsCourses,
},
})
import * as courses from '@/db/schema/courses'
import * as studentsCourses from '@/db/schema/courses-students'
import * as users from '@/db/schema/users'
import { drizzle } from 'drizzle-orm/node-postgres'
import { Client } from 'pg'

const client = new Client({
connectionString: `postgres://user:password@host:port/db`,
})

export const db = drizzle(client, {
schema: {
...users,
...courses,
...studentsCourses,
},
})
?
2 Replies
piscopancer
piscopancerOP7mo ago
i want to move from sqlite to posgresql. Previously I did not need to use anything at all and stored my dev local.db in the root folder, now with postgres things got complicated. I cannot use local.db with postgres, or can I?
Angel
Angel7mo ago
Moving from SQLite to PostgreSQL involves a few changes, mainly because SQLite is a serverless database, while PostgreSQL requires a running server. Here’s a breakdown of what you need to know and do: SQLite: Stores the entire database in a single file (e.g., local.db), which can be easily accessed and managed without needing a separate server. With SQLite you need a minimal setup, the SQLite library and a local file like {localdb} to use it PostgreSQL: Requires a running server to manage databases. The data is stored in a more complex file structure managed by the server itself. Needs a server either local (you can install it) or with a remote provider like AWS, Heroku, ...
Want results from more Discord servers?
Add your server