#Connecting to Existing PostgreSQL DB with Payload

11 messages · Page 1 of 1 (latest)

glad cypressBOT
#

Hi everyone! i am totally new to Payload and i hade a qaustion about how can i connect with an existing postgrsDb?
thnx in advance

vapid vineBOT
#

Original message from @lyric obsidian - Moved from #general message

knotty cipher
#

Hey @lyric obsidian , welcome! Questions like this usually go into #1031993785971900556

#

I can help you out

lyric obsidian
#

Thank you so much @knotty cipher

knotty cipher
#

Are you using 2.0 or trying out the new 3.0 beta?

lyric obsidian
#

3.0

knotty cipher
#

Got it, did you happen to try using create-payload-app@beta?

#

(It currently has issues swapping in the pg adapter, fix coming soon). I can give you some steps, though

#

The general steps will be to ensure you have @payloadcms/db-postgres beta version installed via pnpm add @payloadcms/db-postgres@beta, then swap in the adapter in your payload config

  db: postgresAdapter({
    pool: {
      connectionString: process.env.DATABASE_URI,
    },
  }),

NOTE: Ensure this env var matches up to what you are setting it as in your .env