Simskii
11/27/2019, 6:31 PMRobert Hall
11/28/2019, 2:26 AMMohsin Raza
11/28/2019, 6:34 AMMohsin Raza
11/28/2019, 6:34 AMMohsin Raza
11/28/2019, 6:35 AMIndrek Lasn
11/28/2019, 10:06 AMprisma.js
file?Faraaz Nishtar
11/28/2019, 1:41 PMdatamodel.graphql
package.json
prisma.yml
src
generated
index.ts
resolvers.ts
schema.graphql
My prisma.yml
endpoint: <http://localhost:4666>
datamodel: datamodel.graphql
generate:
- generator: typescript-client
output: ./src/generated/prisma-client/
My GraphQL Yoga server index.ts
import { GraphQLServer } from 'graphql-yoga'
import { prisma } from './generated/prisma-client'
import { resolvers } from './resolvers'
const server = new GraphQLServer({
typeDefs: './src/schema.graphql',
resolvers,
context: { prisma },
})
server.start(() => console.log('Server is running on <http://localhost:4000>'))
When I go to my Prisma Engine Playground on <http://localhost:4466>
I can see all of the Prisma generated Queries. And when I start my server on <http://localhost:4000>
I only see my custom resolvers. How can I get it so that both my custom resolvers and the Prisma generated queries are available? Been banging my head on this one for a while. Hoping someone more experienced might know whatâs going on?JamesJ
11/28/2019, 1:45 PMIndrek Lasn
11/28/2019, 7:56 PMflorian
11/29/2019, 1:45 AMprisma-binding
and I would like to retrieve the updatedAt
field from an update query, unfortunately it seems not possible, i get the following : Field "updatedAt" is not defined by type [TypeName]UpdateInput.
florian
11/29/2019, 1:45 AMflorian
11/29/2019, 1:48 AMupdatedAt: DateTime! @updatedAt
in Prisma's datamodel)Raeesaa
11/29/2019, 12:45 PMcontains
for querying data with substring and it looks like if search term has special characters, it does not give expected result.
For example, I created test table with name
fields set to demo
, test_data
and data
and when we fire query as name_contains: "t_"
, it returns records with name as test_data
as well as data
.
Is there anyway to escape special characters while using contains
?Luca Corsilli
11/29/2019, 2:52 PMprisma deploy
using the Demo server and I get this error:
$ prisma deploy
? Set up a new Prisma server or deploy to an existing server? Demo server + MySQL database
Authenticating !
ERROR: GraphQL Error (Code: 400)
{
"error": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n<HTML><HEAD><META HTTP-EQUIV=\"Content-Type\" CONTENT=\"text/html; charset=iso-8859-1\">\n<TITLE>ERROR: The request could not be satisfied</TITLE>\n</HEAD><BODY>\n<H1>400 ERROR</H1>\n<H2>The request could not be satisfied.</H2>\n<HR noshade size=\"1px\">\nBad request.\nWe can't connect to the server for this app or website at this time. There might be too much traffic or a configuration error. Try again later, or contact the app or website
owner.\n<BR clear=\"all\">\nIf you provide content to customers through CloudFront, you can find steps to troubleshoot and help prevent this error by reviewing the CloudFront documentation.\n<BR clear=\"all\">\n<HR noshade size=\"1px\">\n<PRE>\nGenerated by cloudfront (CloudFront)\nRequest ID: cz85zoi76LETgNaFLeznNOJyPDLGPUp3N1lz1HwoVk6xkhAA8GrjJA==\n</PRE>\n<ADDRESS>\n</ADDRESS>\n</BODY></HTML>",
"status": 400
}
Get in touch if you need help: <https://slack.prisma.io>
To get more detailed output, run $ export DEBUG="*"
I'm behind a corporate proxy and I did export both HTTP_PROXY
and HTTPS_PROXY
envs in my System (and User) environment in Windows.
What am I doing wrong?kitze
11/29/2019, 7:35 PMWesley Schleumer de GĂłes
11/29/2019, 7:39 PMUser
that links to a table called users
? On prisma1 i could do this with the @db(name: 'users')
but this does not apply to prisma2.Christopher Ayling
11/29/2019, 11:15 PMkitze
11/30/2019, 7:23 AM$fragment
?Ahmet
11/30/2019, 2:18 PMError: The Migration failed and has not been performed. This is very likely not a transient issue.
org.postgresql.util.PSQLException: ERROR: column âcontentâ of relation âMessageâ already exists
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2433)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2178)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:306)
Marton Langa
11/30/2019, 3:10 PMMichael Cheng
11/30/2019, 9:21 PMquery($sort: TagOrderBy!, $first: Int!, $after: String) {
allTags(orderBy: $sort, first: $first, after: $after) {
But it doesn't seem to be respecting the orderBy
. I'm getting duplicate items in the fetchMore
result.James David Bradly Carballo
12/01/2019, 2:43 AMJames David Bradly Carballo
12/01/2019, 2:45 AMJames David Bradly Carballo
12/01/2019, 2:48 AMtype Condominium @db(name: "condominium") {
id: UUID! @id
amenities: Float
cbd: String
city: String
condoName: String! @db(name: "condo_name")
developerName: String @db(name: "developer_name")
launchDate: String @db(name: "launch_date")
location: String
lotAreaSqm: Float @db(name: "lot_area_sqm")
marketPositioning: Float @db(name: "market_positioning")
meltedMps: [MeltedMp] @relation(name: "CondoMeltedmp")
noOfFloors: Int @db(name: "no_of_floors")
turnover: Float
}
type Cost @db(name: "cost") {
id: Int! @id(strategy: SEQUENCE) @sequence(name: "cost_id_seq", initialValue: 1, allocationSize: 1)
costLevel: String @db(name: "cost_level")
year2015: Int @db(name: "year_2015")
year2016: Int @db(name: "year_2016")
year2017: Int @db(name: "year_2017")
year2018: Int @db(name: "year_2018")
year2019: Int @db(name: "year_2019")
}
type MeltedMp @db(name: "melted_mp") {
id: Int! @id(strategy: SEQUENCE) @sequence(name: "melted_mp_id_seq", initialValue: 1, allocationSize: 1)
condo: Condominium! @relation(name: "CondoMeltedmp")
computes: String
data1br: Float @db(name: "data_1br")
data2br: Float @db(name: "data_2br")
data3br: Float @db(name: "data_3br")
data4br: Float @db(name: "data_4br")
data5br: Float @db(name: "data_5br")
others: Float
quarter: String
studio: Float
year: Int
}
here's my schema.graphql:
# import Condominium from './generated/prisma.graphql'
# import MeltedMp from './generated/prisma.graphql'
type Query {
condominiums: [Condominium!]!
condominium(id: UUID!): Condominium
getAllMps: [MeltedMp!]!
getOneMp(id: Int!): MeltedMp!
}
type Condominium {
id: UUID!
amenities: Float
cbd: String
city: String
condoName: String!
developerName: String
launchDate: String
location: String
lotAreaSqm: Float
marketPositioning: Float
noOfFloors: Int
turnover: Float
meltedMps: [MeltedMp!]
}
type MeltedMp {
id: Int!
computes: String
condo: Condominium!
data1br: Float
data2br: Float
data3br: Float
data4br: Float
data5br: Float
others: Float
quarter: String
studio: Float
year: Int
}
While here is my index.js:
const { GraphQLServer } = require('graphql-yoga')
const { prisma } = require('../prisma/generated/prisma-client')
const resolvers = {
Query: {
condominiums: (_, args, context) => {
// ...
return context.prisma.condominiums()
},
condominium: (_, {id}, context) => {
return context.prisma.condominium(
{
id
}
)
},
getAllMps: (_, args, context) => context.prisma.meltedMps(),
getOneMp: (_, {id}, context) => prisma.meltedMp(
{
id
}
)
},
Condominium: {
meltedMps: parent => {
return prisma.condominium({id: parent.id}).meltedMps()
},
id: (parent, args, context) => parent.id
},
}
const server = new GraphQLServer({
typeDefs: 'src/schema.graphql',
resolvers,
context: { prisma }
})
server.start(() => console.log(`GraphQL server is running on <http://localhost:4000>`))
rein
12/01/2019, 1:05 PMs.b
12/01/2019, 6:14 PMEric Reis
12/02/2019, 5:43 AMBen
12/02/2019, 7:48 AMLasse Abelsen
12/02/2019, 12:44 PMtype Person
{
txPrimaryKey: String @unique
id: ID! @id
PersonName: [PersonName] @relation(name:"Person_PersonName")
}
and
type PersonName
{
txPrimaryKey: String @unique
id: ID! @id
givenName: String
surname: String
Person: Person @relation(name:"Person_PersonName")
}
Where we query person:
query {
person(where: { txPrimaryKey: "morethan26characters1234567890" }) {
genderCode
PersonName {
surname
givenName
}
}
}
That query will be translated to the following:
select
""default$default"".""Person"".""id"",
""default$default"".""Person"".""genderCode"",
from ""default$default"".""Person""
where ""default$default"".""Person"".""txPrimaryKey"" = $1","parameters: $1 = 'morethan26characters1234567890'"
Plus:
select
"Alias"."surname",
"Alias"."givenName",
"Alias"."id",
"RelationTable"."id" as "__RelatedModel__",
"RelationTable"."Person" as "__ParentModel__"
from "default$default"."PersonName" as "Alias"
join "default$default"."PersonName" as "RelationTable"
on "Alias"."id" = "RelationTable"."id"
where "RelationTable"."Person" in ($1)
order by "RelationTable"."id" asc
As you can see, the query turns into two statements, the last one selecting from PersonName and then joining it with.. PersonName (and also performed an expensive order by)
We're using prisma image 1.34 and postgres 11.
Any pointers appreciated.Jahmiamor
12/02/2019, 2:37 PM