soren
08/04/2019, 2:14 PMJo
08/04/2019, 2:44 PMimpowski
08/05/2019, 8:30 AMnexus
and nexus-prisma
? I need to be able to use it with apollo-server
and have no idea how to get it working and generate schema.graphql
with it.Chad H
08/05/2019, 10:09 AMkitze
08/05/2019, 3:17 PMJo
08/05/2019, 3:27 PMBill Pliske
08/05/2019, 4:18 PMJeremiah
08/05/2019, 6:58 PMYou are trying to set the relation 'BlueTeam' from 'Match' to 'Team' and are only providing a relation directive with a name on 'Match'. Please also provide the same named relation directive on the relation field on 'Team' pointing towards 'Match'.
Here's my model:
type Match {
id: ID! @id
players: [Player!]! @scalarList(strategy: RELATION)
red: Team! @relation(name: "RedTeam")
blue: Team! @relation(name: "BlueTeam")
winner: String!
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
type Team {
id: ID! @id
top: Player! @relation(name: "Top")
jungle: Player! @relation(name: "Jungle")
mid: Player! @relation(name: "Mid")
carry: Player! @relation(name: "Carry")
support: Player! @relation(name: "Support")
matches: [Match]! @scalarList(strategy: RELATION)
}
type Player {
id: ID! @id
role: String!
matches: [Match]! @scalarList(strategy: RELATION)
createdAt: DateTime! @createdAt
updatedAt: DateTime! @updatedAt
}
What is a fix for this or is there a better way to represent the teams?Jo
08/05/2019, 8:43 PMPedro Jardim
08/05/2019, 11:13 PMNeme Sáenz
08/06/2019, 2:51 AMChad H
08/06/2019, 11:52 AMprisma deploy
. when I run this on ubuntu, I kept getting "Service is already up to date." when in fact there is nothing generated on the database. If I run prisma delete
, I get ERROR: GraphQL Error (Code: 400). prisma delete --force
ran without error but doesn't seem to do anything
I'm using 1.34.3 for both the CLI and server
node 10.16.1
prisma.yml:
endpoint: <http://xx.xxx.xx.xx:4466>
datamodel: datamodel.prisma
generate:
- generator: javascript-client
output: ./generated/prisma-client/
docker-compose.yml:
version: '3'
services:
prisma:
image: prismagraphql/prisma:1.34
restart: always
ports:
- "4466:4466"
environment:
PRISMA_CONFIG: |
port: 4466
# uncomment the next line and provide the env var PRISMA_MANAGEMENT_API_SECRET=my-secret to activate cluster security
# managementApiSecret: my-secret
databases:
default:
connector: mysql
host: >-
someserver....
database: dbname
user: someuser
password: somepassword
rawAccess: true
port: '3306'
migrations: true
I tried to remove docker container and image and re-installed everything. Still get the same issue. Please help. Thanks!bbousque
08/06/2019, 5:59 PMChristopher M
08/06/2019, 6:30 PMIsaac Weber
08/06/2019, 7:20 PMRonnie Gauny
08/06/2019, 9:31 PMJoseph
08/07/2019, 2:59 AMprisma deploy
wasn't updating the String type to the specified Enum type.
But now I'm getting errors about relation MY_TABLE doesn't exist
because it's still trying to run migrations instead of set everything up. Is there a way to clear it's migration cache?tmoney
08/07/2019, 3:29 AMCorey Snyder
08/07/2019, 3:30 AMtype User {
id: ID! @id
name: String!
email: String! @unique
active: Boolean @default(value: false)
}
type EmailVerification{
id: ID! @id
verificationCode: String!
user: User!
}
Is it possible to query for the email verification where user.email=test@example.com
I’m trying to query it like this but it’s not working and I’ve tried a bunch of different versions to no avail
let emailVerification = await context.prisma.emailVerifications({
where:{
user: {connect: {email: args.email}}
}
});
Logan Lee
08/07/2019, 3:47 AMAndros Wong
08/07/2019, 5:59 PMiago
08/07/2019, 8:06 PM{ delete: true }
through an optional back-link within an update
, because it's only valid if it exists. should this be an issue?Chad H
08/08/2019, 2:47 AMBrad Goldsmith
08/08/2019, 1:45 PM[WARNING] in /Users/bradgoldsmith/Desktop/Advanced-React/sick-fits/backend/prisma.yml: Invalid variable reference syntax for variable env.PRISMA_ENDPOINT. You can only reference env vars, options, & files. You can check our docs for more info.
In my .yml file I reference my .env
vars like this: endpoint: ${env.PRISMA_ENDPOINT}
Any ideas?Corey Snyder
08/08/2019, 2:53 PMType Resolvers
to get access to those Types? Example:
type User {
id: ID! @id
name: String!
email: String! @unique
active: Boolean @default(value: false)
updatedBy: User @relation(name: "EditedUser")
updatedAt: DateTime @updatedAt
password: String!
links: [Link!]!
votes: [Vote!]!
flightControllers: [FlightController!]! @relation(name: "AddedFlightControllers")
editedFlightControllers: [FlightController!]! @relation(name: "EditedFlightControllers")
addedMerchants: [Merchant!]! @relation(name: "AddedMerchants")
editedMerchants: [Merchant!]! @relation(name: "EditedMerchants")
AddedFlightControllers: [FlightControllerMerchantLink!]! @relation(name: "AddedFlightControllerMerchantLinks")
role: Role @default(value: USER)
emailVerification: [EmailVerification] @relation(name: "UserEmailVerifications")
}
Now in my code I want to query for a user, and get all of the child types populated in my code. If I simply return the user, I’m able to query the child types just fine via GraphQL queries but if in my code I needed a list of the votes I have to re-run the query:
context.prisma.user({ id: args.user.id }).votes()
and if I wanted the links
context.prisma.user({ id: args.user.id }).links()
Is there a way to get this in 1 go?Corey Snyder
08/08/2019, 2:58 PMcontext.prisma.user({ id: args.user.id })
It appears that I can only do searches on certain fields, maybe ones marked as unique? Or maybe just IDs? If I try to run context.prisma.user({ email: '<mailto:corey@test.com|corey@test.com>' })
prisma throws errors that email isn’t on the list of properties which can be searched. This requires me to instead use context.prisma.users({ where: {email: '<mailto:corey@test.com|corey@test.com>' }})
which returns an array of items which I immediately have to get at the first item in the array like:
let user = (await context.prisma.users({
where: {
email: args.email.toLowerCase(),
}
}))[0] <<-- this part kinda sucks..
Am I doing this wrong? Is there a better way to go about it?tmoney
08/08/2019, 5:37 PMnull
. I want it to return a list of nodes where
the relationship is null
. This worked fine in graphcool, but now it doesn’t seem to be the way that you need to do it in Prisma.
Here’s my query:
query getCompanyAndFees($companyId: ID!) {
Company: company(
where: {
id: $companyId
}
) {
id
fees(
where: {
isEnrollmentFee: true
tuitionServiceFeeForCompany: null
},
orderBy: name_ASC
) {
id
name
tuitionServiceFeeForCompany {
id
}
}
}
}
This query gives me back the following payload:
{
"data": {
"Company": {
"id": "cjac65ek0127b0",
"fees": []
}
}
}
If I comment out this condition in the where clause: tuitionServiceFeeForCompany: null
You can see I get back several fees where tuitionServiceFeeForCompany
is null
{
"data": {
"Company": {
"id": "cjac65ek0127b0",
"fees": [
{
"id": "cjaz34ym31hdi0,
"name": "53 Books",
"tuitionServiceFeeForCompany": null
},
{
"id": "cjaz37nm71he7",
"name": "CD & Flash Cards",
"tuitionServiceFeeForCompany": null
}
]
}
}
}
It should be getting back that last result without commenting out the tuitionServiceFeeForCompany: null
Muhaki
08/09/2019, 7:24 AMKhoa Le
08/09/2019, 3:34 PMKhoa Le
08/09/2019, 3:36 PM