Marco Moi
09/27/2021, 11:52 AMMatija Sosic
09/27/2021, 2:34 PMList
which has one more Card
s (imagine Trello). If for a particular card I want to change ownership (make it owned by another list), how I can do that?
export const updateCard = async ({ cardId, data }, context) => {
return context.entities.Card.update({
where: { id: cardId },
data: {
// What should I write below? A failed attempt:
list: { connect: { id: data.listId } }
}
})
}
Justin Ellingwood
09/27/2021, 3:10 PMBamada
09/27/2021, 4:00 PMnpx prisma migrate dev --create-only
but I still get a prompt that request me to reset my database what i want to avoid.
Is it possible to do that without reset my db?
/app $ npx prisma migrate dev --create-only
Environment variables loaded from .env
Prisma schema loaded from prisma/schema.prisma
Datasource "db": PostgreSQL database "mercure", schema "public" at "db:5432"
? Drift detected: Your database schema is not in sync with your migration history.
The following is a summary of the differences between the expected database schema given your migrations files, and the actual schema of the database.
It should be understood as the set of changes to get from the expected schema to the actual schema.
[+] Added tables
- mercure_configs
- mercure_responses
[*] Changed the `mercure_configs` table
[+] Added unique index on columns (po)
We need to reset the PostgreSQL database "mercure" at "db:5432".
Do you want to continue? All data will be lost. › (y/N)
Ibad Shaikh
09/27/2021, 7:45 PM_await prisma.model.count_({
      _select_:_ _{
        _id_: _true_,
        _user_:_ _{
          _select_:_ _{
            _username_: _true_,
_Â Â Â Â Â Â Â Â Â Â _},
_Â Â Â Â Â Â Â Â _},
        _category_:_ _{
          _select_:_ _{
            _name_: _true_,
_Â Â Â Â Â Â Â Â Â Â _},
_Â Â Â Â Â Â Â Â _},
_Â Â Â Â Â Â _})
As we already knew that currently its not possible to use select and include at the same time.
So I came through another approach without using the include keyword and just directly create a nested object on the field you had a relation with like in my case its user and category.
The above query is working fine on .findMany() but it fails on .count().
it throws the error above :
_Unknown field user
for select statement on model PostCountAggregateOutputType. Available options are listed in green. Did you mean user_id
?_Mischa
09/28/2021, 6:46 AMAlexei Snisarenko
09/28/2021, 11:40 AM"Timed out fetching a new connection from the connection pool"
which now does not disappear. there is no activity currently in the app but when try to do query get this error.
Did anybody face such a problem and if yes what would be possible reason of the problem do get addressed?
Any advice would be highly appreciatedJonas Rothmann
09/28/2021, 12:24 PMjt
09/28/2021, 4:21 PMuser
09/28/2021, 5:20 PMgaryditsch
09/28/2021, 6:03 PMJoseph
09/29/2021, 12:40 AMMagne Skutle
09/29/2021, 7:26 AMuser
09/29/2021, 7:27 AMhttps://www.youtube.com/watch?v=f1KxJi-2PFo&list=PLn2e1F9Rfr6k6MwzS-p9FGK1NDBxxwLPk&index=11&pp=sAQBâ–¾
Jaroslav Malek
09/29/2021, 3:03 PMId
even tho it’s not meant to be a foreign key, the mutation errors. Example:
prisma.business.create({
data: {
name: data.name,
// This is just a string and it is not supposed to be a FK, but Prisma thinks so
taxId: data.taxIdentifier,
address: {
create: {...},
},
clientOf: {
connect: {
id: businessId,
},
},
},
})
The way to fix this is to rename it from taxId
to taxIdentifier
for example. I was trying to find an issue in Github, but there is just so many issues and it’s hard to find it.Harsha MV
09/29/2021, 3:36 PMrismaClientKnownRequestError:
Invalid `prisma.projectType.findMany()` invocation:
Timed out fetching a new connection from the connection pool. (More info: <http://pris.ly/d/connection-pool>, Current connection limit: 17)
at cb (/Users/harshamv/Sites/nftvoltclub/node_modules/@prisma/client/runtime/index.js:36952:17)
at async getServerSideProps (webpack-internal:///./pages/list-project.js:27:24)
at async Object.renderToHTML (/Users/harshamv/Sites/nftvoltclub/node_modules/next/dist/server/render.js:473:24)
at async doRender (/Users/harshamv/Sites/nftvoltclub/node_modules/next/dist/server/next-server.js:1127:38)
at async /Users/harshamv/Sites/nftvoltclub/node_modules/next/dist/server/next-server.js:1221:28
at async /Users/harshamv/Sites/nftvoltclub/node_modules/next/dist/server/response-cache.js:60:36 {
code: 'P2024',
clientVersion: '3.1.1',
meta: { connection_limit: 17 }
}
this is my prisma file:
import { PrismaClient } from '@prisma/client';
let prisma;
if (process.env.NODE_ENV === 'production') {
prisma = new PrismaClient();
} else {
if (!global.prisma) {
global.prisma = new PrismaClient();
}
prisma = global.prisma;
}
export default prisma;
Anonymous World
09/29/2021, 5:45 PMOleg Yarin
09/29/2021, 6:20 PMNathaniel Babalola
09/29/2021, 7:49 PMElie Steinbock
09/30/2021, 1:16 AMpgbouncer=true&pool_timeout=60
to our database url but we’re still getting timeouts on not enough connections.
db has 1gb ram and 1 cpu
seeing this error a lot:
Timed out fetching a new connection from the connection pool. (More info: <http://pris.ly/d/connection-pool>, Current connection limit: 17)
user
09/30/2021, 11:00 AMhttps://www.youtube.com/watch?v=-x7yENX3s9M&list=PLn2e1F9Rfr6k6MwzS-p9FGK1NDBxxwLPk&index=10â–¾
user
09/30/2021, 11:02 AMNathaniel Babalola
09/30/2021, 11:59 AMCan't reach database server at <http://db.xxxxxx.supabase.co:5432|db.xxxxxx.supabase.co:5432>
.
This isn't from my internet as I am making other network requests in my app and they're successful.Phil Bookst
09/30/2021, 12:22 PMYaakov
09/30/2021, 12:37 PMMAX
, UPPER
, TRIM
, etc.)
Obviously, everything could be accomplished by using raw statements, but I'm looking to stay away from that as much as possible.
Any other comments/suggestions are welcome and appreciated! 😄
Thanks in advance!Conor Wade
09/30/2021, 12:44 PMAngelo
09/30/2021, 1:32 PMprisma.$connect("another-db-name")
but that doesn't seem to work, any ideas?
ThanksVladi Stevanovic
Tom
09/30/2021, 3:08 PMSELECT f.id, jsonb_agg(to_jsonb(n)) FROM (
SELECT f.id AS id, n.amount FROM "Food" AS f
JOIN "NutrientValue" AS n ON f.id = n."foodId"
WHERE n."nutrientId" = 1
ORDER BY n.amount
) AS f
JOIN "NutrientValue" AS n ON f.id = n."foodId"
GROUP BY f.id, f.amount ORDER BY f.amount;
Darryl Morley
09/30/2021, 3:21 PM