datasource postgresql {
provider = "postgresql"
url = "postgresql://..."
}
generator client {
provider = "prisma-client-js"
}
model User {
id Int @default(autoincrement()) @id
email String @unique
name String?
role String?
storeId Int?
}
model Product {
id Int @default(autoincrement()) @id
handle String @unique
name String?
description String?
price Int?
}
const express = require('express')
const app = express()
const port = process.env.PORT || 3000;
// const path = require('path')
const { PrismaClient } = require('@prisma/client')
const prismaPgPlain = new PrismaClient({
log: ['query', 'info', 'warn'],
datasources: {
db: "asdfasdf",
},
//forceTransactions: true,
})
app.get('/api/pg-plain', async (req, res) => {
const products = await prismaPgPlain.product.findMany({ first: 4 })
res.send(JSON.stringify(products))
})
app.listen(port, () =>
console.log(`Example app listening at http://localhost:${port}`),
)
This should not work as the database connection string is overwritten with asdfasdf - but it happily connects to the connection string from schema.prisma.
This should not work as the database connection string is overwritten with
asdfasdf- but it happily connects to the connection string fromschema.prisma.