Momin
07/13/2020, 3:24 AMMomin
07/13/2020, 3:24 AMMomin
07/13/2020, 3:24 AMMomin
07/13/2020, 3:25 AMNaimur Rahman
07/13/2020, 3:29 AMMomin
07/13/2020, 3:30 AMMomin
07/13/2020, 3:30 AMMomin
07/13/2020, 3:30 AMMomin
07/13/2020, 3:31 AMNaimur Rahman
07/13/2020, 3:31 AMMomin
07/13/2020, 3:31 AMMomin
07/13/2020, 3:31 AMNaimur Rahman
07/13/2020, 3:31 AMkitze
07/13/2020, 11:55 AMset
. Is there a way to push a string in the array without querying the strings that are already there?Corey Snyder
07/13/2020, 6:01 PMUser
relationship to the name Author
on Posts
. My question is, if you do this, and then re-run an introspection, will it blow away your changes? Or does it do a diff and intelligently update the schema file?SureDroid
07/13/2020, 9:34 PMSureDroid
07/13/2020, 9:57 PMrebaza951
07/13/2020, 10:27 PMrebaza951
07/13/2020, 10:32 PMAlvin Khaled
07/14/2020, 3:23 AMJonathan Romano
07/15/2020, 3:35 AMDarryl
07/15/2020, 7:45 AMyourethejudge
07/15/2020, 8:55 AMstephan
07/15/2020, 9:16 AMDmitri Pisarev
07/15/2020, 3:06 PMJonathan Romano
07/15/2020, 6:34 PMDaniel
07/16/2020, 6:16 AMCREATE TABLE presets (
id SERIAL PRIMARY KEY,
uid character(5) NOT NULL REFERENCES tokens(uid) ON DELETE CASCADE,
deviceid integer NOT NULL,
data jsonb NOT NULL,
synced smallint NOT NULL DEFAULT 0,
isdeleted boolean NOT NULL DEFAULT false,
lfid integer,
error jsonb
);
Now when i am trying to delete a row on said tokens
table
await prisma.tokens.delete({
where: {
uid
}
});
it gives me an violation error
Invalid `prisma.tokens.delete()` invocation in
path/dist/data.js:314:84
The change you are trying to make would violate the required relation 'tokens' between the `presets` and `tokens` models.
at PrismaClientFetcher.request (path/node_modules/@prisma/client/runtime/index.js:1:185690)
at process._tickCallback (internal/process/next_tick.js:68:7)
code: 'P2014',
meta:
{ relation_name: 'tokens',
model_a_name: 'presets',
model_b_name: 'tokens' } }
I am quite confused on what i am doing wrong, any tips appreciated.Mohammed alreai
07/16/2020, 8:25 AMJonathan
07/16/2020, 10:11 AM# Scenario 1: Do a single Prisma call on Posts-level (Level A)
{
posts { # <-- Level A: Do a single prisma.many call, and actually include all users, profilePictures, with all of their
users { # <-- Level BāOn the user-resolver, do we then have to do a superfluous another call (even if level A already got all of their info?)
name
title
birthDate
derivedNrOfFriends
profilePictures { # <-- Level C āOn the profilePictures resolver, do we do a call even if the posts already included everything necessary?
...etc
}
friends {
}
}
}
}
# Scenario 2: Do multiple Prisma call on each resolver (Level A, Level B, Level C)
{
posts { # <-- Level A: Do a prisma.many call, only include post fields
users { # <-- Level BāDo a prisma.many call, only include user fields, use optionally parent.id to scope on posts
name
title
birthDate
derivedNrOfFriends
profilePictures { # <-- Level C. Do a prisma.many on profilePictures resolver level, use optionally parent.id to scope on users
...etc
}
friends {
}
}
}
}
Suhail
07/16/2020, 12:22 PMprisma deploy
. The error says You are updating the field _permissions_ to be required. But there are already nodes for the model _User_ that would violate that constraint
What does this really mean? Here is how my user
model looks like:
type User {
id: ID! @id
email: String @unique
firstName: String!
lastName: String!
isActive: Boolean! @default(value: true)
isVerified: Boolean! @default(value: false)
isUsingSystemPassword: Boolean! @default(value: true)
userType: UserType @default(value:Admin)
password: Password! @relation(name: "UserPassword", onDelete: CASCADE)
projects: [Project] @relation(name:"UserProjects", onDelete: CASCADE)
productFeedback: [ProductFeedback] @relation(name: "ProductFeedback")
permissions: Permissions! @relation(name: "UserPermissions", onDelete: CASCADE)
createdBy: UserCreationMap! @relation(name: "CreationMap", onDelete: CASCADE)
}
and how my Permissions
models looks like
type Permissions {
id: ID! @id
createUser: Boolean! @default(value: false)
editUser: Boolean! @default(value: false)
deleteUser: Boolean! @default(value: false)
viewAllUsers: Boolean! @default(value: false)
userId: User @relation(link: INLINE, name: "UserPermissions")
}