Nurul
08/25/2022, 6:52 AMBen Patton
08/25/2022, 2:58 PMMichael Roberts
08/25/2022, 3:31 PMMichael Roberts
08/25/2022, 3:32 PMany
value.Michael Roberts
08/25/2022, 7:18 PMMischa
08/25/2022, 8:29 PMJohn Rinehart
08/25/2022, 8:42 PMprisma
with nesjs
and I have a very small part of my application where I temporarily need to change the connection (different credentials).John Rinehart
08/25/2022, 8:42 PMprisma
with nestjs
that I see involve configuring the DB at start-up. Makes sense for most use cases, but how can I accomplish an ephemeral connection?John Rinehart
08/25/2022, 8:43 PMAustin
08/25/2022, 9:02 PMschema.prisma
dictates what field name will be used in the Prisma Client queries.
You could rename the field to users
in your schema, but with an explicit m2m relation, it’s often helpful to know at a glance what fields relate to the join table directly so it’s common practice to use names like usersOnActivities
.Adam Żbikowski
08/25/2022, 11:02 PMprisma migrate deploy
.
I have a Postgres db running in a separate container with a generated connection string that is passed via env vars.
For some reason I keep getting this error during build: Error: P1001: Can't reach database server at <postgres_container_name>:5432
I have verified I can connect to the database container by pinging it from a different app container (my frontend), but the CMS along with Prisma won't connect to it.
If it helps, my server runs on arm64 architecture, and I have tried both Node v16 (LTS) and v14 images for the build. I also tried adding a connection timeout to my connection string. Nothing helps!
Any pointers highly appreciated.Jacob Coker-Dukowitz
08/25/2022, 11:41 PMBen Guthrie
08/26/2022, 5:23 AMCan't reach database server at ...
from Prisma. These errors show up usually when we're running a lot of queries at once. Most of the queries will work and then one random query will throw this error. Previously, we've seen helpful errors about connection limits/timeouts and tuned out parameters accordingly. But now it seems like something is shutting down the entire connection to the database.The Postgres db we're using is hosted on AWS RDS.
Has anyone seen anything like this?
Any tips for how we can debug what is causing Prisma to not be able to reach the db?Nurul
08/26/2022, 9:38 AMYerzhan
08/26/2022, 10:14 AMDATABASE_URL
for CloudSQL
when project deployed with GCP Cloud Run
.
I’m using postgresql
.
already tried these approaches:
1. DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@${CLOUD_SQL_Public_IP_address}/${DB_DATABASE}?socket=/cloudsql/${CLOUD_SQL_INSTANCE_CONNECTION_NAME}&connection_limit=50&pool_timeout=30
2. DATABASE_URL=postgresql://${DB_USER}:${DB_PASS}@localhost/${DB_DATABASE}?schema=public&host=/cloudsql/${CLOUD_SQL_INSTANCE_CONNECTION_NAME}
But still having this issue:
Can't reach database server at `xxx.xxx.xx.x`:`5432`
Please make sure your database server is running at `xxx.xxx.xx.x`:`5432`.
Prisma clientVersion: ‘3.13.0’
Thank you!!!Matheus Assis
08/26/2022, 3:20 PMfindUnique
more recommended than just fetching with findMany
What’s the difference between
db.users.findUnique({ where: { id } }).posts()
and
db.posts({where: { userId: id }})
Edit:
Oh I found this: https://www.prisma.io/docs/guides/performance-and-optimization/query-optimization-performance#solving-n1-in-graphql-wit[…]que-and-prismas-dataloaderMischa
08/26/2022, 3:39 PMPhorcys
08/26/2022, 8:03 PMPhorcys
08/26/2022, 8:07 PMmodel Teacher {
id String @id @default(cuid())
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
userId String @unique
}
Millerbyte
08/26/2022, 10:38 PMread stream
that reads raw csv data -> pipes that into a write stream
that parses the data using csv-parse
-> pipes that into a transform stream
that converts it into a javascript object / entity. I would like to add a final write stream
at the end of this pipeline that inserts each entity, one at a time (or in a batch), all in one transaction.David Ilizarov
08/26/2022, 11:22 PMDavid Ilizarov
08/26/2022, 11:22 PMDave Edelhart
08/27/2022, 3:44 AMCryptic
08/27/2022, 9:04 AMKay Khan
08/27/2022, 6:09 PMikbenignace
08/28/2022, 4:03 PMwhere: {
masterId: null,
},
include: {
translations: true,
childs: {
include: {
translations: true,
childs: {
include: {
translations: true,
childs: true,
},
}
},
}
},
ikbenignace
08/28/2022, 4:04 PMMotdde
08/29/2022, 2:43 AMMananshi Jaymin Vyas
08/29/2022, 5:20 AMGustavo
08/29/2022, 5:22 AMTable xxxxxx is marked as crashed and should be repaired
👀
DB Engine: Mariadb
, although when I configured the datasource
is set to mysql
datasource db {
provider = "mysql"
expressjs@24d28168baba:/application$ npx prisma --version
Environment variables loaded from .env
prisma : 4.2.1
@prisma/client : 4.2.1
Current platform : linux-arm64-openssl-1.1.x
Query Engine (Node-API) : libquery-engine 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules/@prisma/engines/libquery_engine-linux-arm64-openssl-1.1.x.so.node)
Migration Engine : migration-engine-cli 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules/@prisma/engines/migration-engine-linux-arm64-openssl-1.1.x)
Introspection Engine : introspection-core 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules/@prisma/engines/introspection-engine-linux-arm64-openssl-1.1.x)
Format Binary : prisma-fmt 2920a97877e12e055c1333079b8d19cee7f33826 (at node_modules/@prisma/engines/prisma-fmt-linux-arm64-openssl-1.1.x)
Default Engines Hash : 2920a97877e12e055c1333079b8d19cee7f33826
Studio : 0.469.0
this is the migration file that makes prisma throw the error:
/*
Warnings:
- You are about to drop the column `documentTypeId` on the `organisationDocuments` table. All the data in the column will be lost.
- You are about to drop the column `organisationId` on the `organisationDocuments` table. All the data in the column will be lost.
- Added the required column `projectId` to the `organisationDocuments` table without a default value. This is not possible if the table is not empty.
*/
-- AlterTable
ALTER TABLE `organisationDocuments` DROP COLUMN `documentTypeId`,
DROP COLUMN `organisationId`,
ADD COLUMN `projectId` INTEGER NOT NULL;
-- AddForeignKey
ALTER TABLE `organisationDocuments` ADD CONSTRAINT `organisationDocuments_projectId_fkey` FOREIGN KEY (`projectId`) REFERENCES `projects`(`id`) ON DELETE RESTRICT ON UPDATE CASCADE;
but I believe the table crashed on a previous migration which is:
-- AlterTable
ALTER TABLE `organisationDocuments` MODIFY `content` LONGTEXT NOT NULL;
so I'm unsure why it was marked as crashed...
This has happened to me several times on different tables whenever I need to alter a table in development, command i'm using is:
inside_container> npx prisma migrate dev --name "...." --schema="path/to/schema.prisma" --skip-seed
Any ideas? 🤔