Pani Avula
01/28/2021, 6:03 PMŁukasz Usarz
01/29/2021, 1:15 PMSimon Knott
01/29/2021, 1:55 PMstephen.pearl
01/29/2021, 2:15 PMRon Mizrahi
01/30/2021, 2:26 PMJijin P
01/30/2021, 4:36 PMawait prisma.campaigns.update({
where: {
id:{
includes: id_lists
}
},
data: {
credits: {
decrement: 10000
}
}
})
Łukasz Usarz
01/31/2021, 8:53 AMphilip andrew
01/31/2021, 11:09 AMphilip andrew
01/31/2021, 12:10 PMYassine
01/31/2021, 1:40 PMiamclaytonray
01/31/2021, 2:16 PMid
column and the expression for uuid is not there. Any advice/direction would be appreciatedKyron
01/31/2021, 5:59 PM{ where: { group: { name: 'A' } } }
and { where: { user: { id: 1 } } data: { groups: { connect: { name: 'A' } } } }
for example, but outside of that, their query should either be overridden with their allowed filters, or guarded againstKyron
01/31/2021, 6:00 PMMarcello
01/31/2021, 7:55 PMMykyta Machekhin
01/31/2021, 10:14 PMUser
this relation type is many to one. Therefore, there should be lists instead single values. Without this, prisma perceives this relation as one to one. What explains creating a unique index
Hello. Seems to have found a bug in the prisma, but I’m not sure about that yet. Therefore, before creating an issue, I want to discuss here. The problem is that the prisma for some reason creates a unique index where it shouldn’t. As a result, I cannot insert duplicate values where they might be
How to reproduce:
In my case I have 2 models, which have three relations:
model User {
userId Int @id @default(autoincrement())
creatorFor Task? @relation(name: "creator")
illustratorFor Task? @relation(name: "illustrator")
motionerFor Task? @relation(name: "motioner")
}
model Task {
taskId Int @id @default(autoincrement())
name String
creator User @relation(fields: [creatorId], references: [userId], name: "creator")
illustrator User? @relation(fields: [illustratorId], references: [userId], name: "illustrator")
motioner User? @relation(fields: [motionerId], references: [userId], name: "motioner")
creatorId Int
illustratorId Int?
motionerId Int?
}
When 2 models are linked by more than 1 relations, the prisma requires you to create names for them in the parent entity, therefore the user has 3 last lines
In this example, I do not need the creator, illustrator, and motion designer to be unique in the task model. However, here’s what I see in the migration:
-- CreateIndex
CREATE UNIQUE INDEX "Task_creatorId_unique" ON "Task"("creatorId");
-- CreateIndex
CREATE UNIQUE INDEX "Task_illustratorId_unique" ON "Task"("illustratorId");
-- CreateIndex
CREATE UNIQUE INDEX "Task_motionerId_unique" ON "Task"("motionerId");
I can’t explain it, and I don’t know what to do with it other than manual editing of migrationsbeeman
02/01/2021, 10:39 PMJarid Margolin
02/01/2021, 11:31 PM<https://github.com/prisma/ent>
but it doesn’t appear there has been any effort to push it forward. Have better patterns emerged? Seems like there could be a useful abstraction here, but perhaps I have the wrong mental model of how I should be utilizing Prisma.ibash
02/02/2021, 4:35 AMibash
02/02/2021, 4:36 AMManthan Mallikarjun
02/02/2021, 9:17 AMpg
instance to prisma?Jamey Nakama
02/03/2021, 12:25 AMManthan Mallikarjun
02/03/2021, 2:07 AMupsertMany
?Martïn
02/03/2021, 2:47 AMmodel Coupon {
id String @id @default(cuid())
code String @unique @expire(after: ‘60s’)
profileId String @unique
...
}
So code
expires and row is deleted from the DB after 60sMartïn
02/03/2021, 11:01 AMThe preview feature \"createMany\" is not known. Expected one of: nativeTypes, microsoftSqlServer, groupBy\n
Created an issue createMany (preview flag) crashes Prisma Studio (Windows): https://github.com/prisma/studio/issues/623Henry
02/03/2021, 12:48 PMPitakun
02/03/2021, 2:52 PMnetlify-lambda serve src //npm command that serves the folder containing my index.js
//index.js
const { ApolloServer } = require('apollo-server-lambda')
const fs = require('fs')
const path = require('path')
const { PrismaClient } = require('@prisma/client')
const { getUserId } = require('./utils.js')
const Query = require('./resolvers/Query')
const Mutation = require('./resolvers/Mutation')
const User = require('./resolvers/User')
const Link = require('./resolvers/Link')
const Vote = require('./resolvers/Vote')
const { PubSub } = require('apollo-server-lambda')
const Subscription = require('./resolvers/Subscription')
const resolvers = {
Query,
Mutation,
User,
Link,
Subscription,
Vote
}
const pubsub = new PubSub()
const prisma = new PrismaClient()
const server = new ApolloServer({
typeDefs: fs.readFileSync(
path.join(__dirname, 'schema.graphql'),
'utf8'
),
resolvers,
context: ({ req }) => {
return {
...req,
prisma,
pubsub,
userId:
req && req.headers.authorization
? getUserId(req)
: null
}
}
})
exports.handler = server.createHandler();
but fails with
netlify-lambda: Starting server
.../node_modules/toml/lib/parser.js:3833
throw peg$buildException(null, peg$maxFailExpected, peg$maxFailPos);
^
[SyntaxError: Expected "'", "'''", "+", "-", "[", "\"", "\"\"\"", "_", "false", "true", "{", [ \t] or [0-9] but "=" found.] {
Not sure what to do to fix this. Please help me 🙏Sébastien Dubois
02/03/2021, 3:09 PMSébastien Dubois
02/03/2021, 3:10 PMNatalia
Rashmi Bidanta
02/03/2021, 4:10 PMCreating stage prod for service service-name... !
error 03-Feb-2021 08:12:09
error 03-Feb-2021 08:12:09 ERROR: Service with name 'service-name' and stage 'prod' already exists
error 03-Feb-2021 08:12:09
error 03-Feb-2021 08:12:09 {
error 03-Feb-2021 08:12:09 "data": {
error 03-Feb-2021 08:12:09 "addProject": null
error 03-Feb-2021 08:12:09 },
error 03-Feb-2021 08:12:09 "errors": [
error 03-Feb-2021 08:12:09 {
error 03-Feb-2021 08:12:09 "locations": [
error 03-Feb-2021 08:12:09 {
error 03-Feb-2021 08:12:09 "line": 2,
error 03-Feb-2021 08:12:09 "column": 9
error 03-Feb-2021 08:12:09 }
error 03-Feb-2021 08:12:09 ],
error 03-Feb-2021 08:12:09 "path": [
error 03-Feb-2021 08:12:09 "addProject"
error 03-Feb-2021 08:12:09 ],
error 03-Feb-2021 08:12:09 "code": 4005,
error 03-Feb-2021 08:12:09 "message": "Service with name 'service-name' and stage 'prod' already exists",
error 03-Feb-2021 08:12:09 "requestId": "local:ckkpkke6206ih08004ib5c5zx"
error 03-Feb-2021 08:12:09 }
error 03-Feb-2021 08:12:09 ],
error 03-Feb-2021 08:12:09 "status": 200
error 03-Feb-2021 08:12:09 }
any help on this would be really great