()
| 7 | // Need a database for production? Check out https://get.neon.com/BMFYNtx |
| 8 | // Tested and compatible with Next.js Boilerplate |
| 9 | export const createDbConnection = () => { |
| 10 | const pool = new Pool({ |
| 11 | connectionString: Env.DATABASE_URL, |
| 12 | }); |
| 13 | |
| 14 | pool.on('error', (error) => { |
| 15 | logger.error(`Database pool error: ${error.message}`); |
| 16 | }); |
| 17 | |
| 18 | return drizzle({ |
| 19 | client: pool, |
| 20 | schema, |
| 21 | }); |
| 22 | }; |