Arun Kumar
07/06/2021, 9:31 AMintrospect
command to update to the schema for the dev env. Now I want to update the schema on the qa env as well. How can I achieve this?Nikhil Goyal
07/06/2021, 11:07 AMuser
07/06/2021, 11:50 AMCopium Dealer
07/06/2021, 2:55 PMconst results = await prisma.token.findMany({
select: {
id: true,
name: true,
symbol: true,
telegram: true,
_count: { select: { votes: true } },
},
orderBy: { votes: { count: "desc" } },
});
However I would like this to be a range query, so I can select tokens in descending order where the date on votes are less than 24 hours ago
If possible, I would also like to select the count of these votes too (but total count is fine if that's not possible).Luc
07/06/2021, 4:54 PMmodel Model {
id String @id
field1 String
field2 String
}
await prisma.Model.find({ where: { field1: { equals: // value of field2 }} });
Peter Kellner
07/06/2021, 5:22 PMCREATE TABLE "Category" (
id SERIAL PRIMARY KEY
);
CREATE TABLE "Post" (
id SERIAL PRIMARY KEY
);
-- Relation table + indexes -------------------------------------------------------
CREATE TABLE "_CategoryToPost" (
"A" integer NOT NULL REFERENCES "Category"(id),
"B" integer NOT NULL REFERENCES "Post"(id)
);
CREATE UNIQUE INDEX "_CategoryToPost_AB_unique" ON "_CategoryToPost"("A" int4_ops,"B" int4_ops);
CREATE INDEX "_CategoryToPost_B_index" ON "_CategoryToPost"("B" int4_ops);
Chris Baucom
07/06/2021, 7:50 PMavatar
in my User model, it doesn’t seem to save. 🧵Jarod G
07/06/2021, 9:03 PMimport { NonEmptyArray } from "type-graphql";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1001:16)
at Module._compile (internal/modules/cjs/loader.js:1049:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (C:\Workspace\Stagewood-Test\server\handler.js:4:19)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
I think it has something to do with how I'm generating the resolvers to TypeScript and using it in the JS handler.
This is what my handler.js looks like:
const graphqlLambda = require('apollo-server-lambda');
const makeExecutableSchema = require('graphql-tools');
const importSchema = require('graphql-import');
const resolvers = require('./prisma/generated/type-graphql/index.ts');
const typeDefs = importSchema('./schema/schema.graphql')
const myGraphQLSchema = makeExecutableSchema({
typeDefs: typeDefs,
resolvers,
});
exports.graphqlHandler = function graphqlHandler(event, context, callback){
function callbackWithHeaders(error, output) {
output.headers['Access-Control-Allow-Origin'] = '*';
callback(error, output);
}
const handler = graphqlLambda({schema: myGraphQLSchema });
return handler(event, context, callbackWithHeaders)
}
Does anyone know how I can get this working on AWS or point me in the right direction?Arun Kumar
07/07/2021, 7:18 AMArun Kumar
07/07/2021, 7:20 AMFROM node:latest as build
# set the working direction
WORKDIR /app
# add `/app/node_modules/.bin` to $PATH
ENV PATH /app/node_modules/.bin:$PATH
# install app dependencies
COPY package.json ./
COPY package-lock.json ./
COPY . ./
RUN npm install
RUN npx prisma generate
CMD "npm" "start"
Dimitri Ivashchuk
07/07/2021, 7:55 AMEvaluations: {
upsert: [
{
where: {
topic_id_assessment_record_id_unique: {
topicId: topicId as string,
assessmentRecordId: recordId as string,
},
},
create: {
User: {
connect: {
id: user.id,
},
},
Topic: {
connect: {
id: topicId as string,
},
},
Level: {
connect: {
id: levelId as string,
},
},
Stage: {
connect: {
id: stageId as string,
},
},
comment: comment as string,
score: 321,
},
update: {
levelId: levelId as string,
stageId: stageId as string,
},
model Evaluation {
id String @id @default(cuid())
assessmentRecordId String
userId String
topicId String
levelId String?
stageId String?
score Float
comment String?
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt @map(name: "updated_at")
Record AssessmentRecord @relation(fields: [assessmentRecordId], references: [id])
User User @relation(fields: [userId], references: [id])
Topic Topic @relation(fields: [topicId], references: [id])
Level Level? @relation(fields: [levelId], references: [id])
Stage Stage? @relation(fields: [stageId], references: [id])
@@unique([topicId, assessmentRecordId], name: "topic_id_assessment_record_id_unique")
@@map(name: "evaluations")
}
Both null
and undefined
as arguments throw error 😕Moh
07/07/2021, 8:23 AMNikhil Goyal
07/07/2021, 10:27 AMTaylor Lindores-Reeves
07/07/2021, 11:15 AMHalvor
07/07/2021, 11:34 AMHalvor
07/07/2021, 11:34 AMHalvor
07/07/2021, 11:34 AMmanuel
07/07/2021, 1:04 PMmanuel
07/07/2021, 1:04 PMCopium Dealer
07/07/2021, 2:08 PMJack Reed
07/07/2021, 2:29 PMctx.prisma.user.findUnique({
where: {
id: user.id,
},
include: {
permissions: true
}
})
Thanks!Dennis
07/07/2021, 4:39 PMHalvor
07/07/2021, 5:35 PMHalvor
07/07/2021, 5:35 PMHalvor
07/07/2021, 5:35 PMCole Voss
07/07/2021, 6:48 PMinit
and all other migrations now have a later dated migration folder name. It seems to have deployed ok in our staging environment, but locally it causes issues. I am thinking about changing the name of the migration folder to a later date, and then manually updating the _prisma_migration.migration_name
to the new name in the database. Does anyone see any glaring issues with that? Thanks!prisma chobo
07/07/2021, 7:24 PMprisma.transaction.findMany({
skip,
take,
where: {
audience,
AND: [
{
accounts: {
some: {
id: accountId,
},
},
},
{
balance: {
some: {
accountId,
},
},
},
],
},
orderBy,
include: {
balance: true,
transfer: true,
payout: true,
fees: true,
fund: true,
},
});
}
gives me
{
"data": {
"transactions": [
{
"id": "ckqtnygnv0032z5vhbb04b2kh",
"type": "TRANSFER",
"description": "test transfer",
"transfer": {
"id": "ckqtnygnv0035z5vhthw2z65e",
"payee": {
"username": "justin",
"id": "ckqtn3kv70003ccvh1ufbyoxv"
},
"payor": {
"id": "ckqtne3lm0128ccvhmpiz9c26",
"username": "dustin"
}
},
"fund": null,
"balance": [
{
"id": "ckqtnygnv0033z5vhdlen44um",
"amount": 5000,
"account": {
"id": "ckqtn3kv70003ccvh1ufbyoxv",
"username": "justin"
}
},
{
"id": "ckqtnygnv0034z5vhvwwbr0z2",
"amount": -5000,
"account": {
"id": "ckqtne3lm0128ccvhmpiz9c26",
"username": "dustin"
}
}
]
}
]
}
}
But for balance entity, I only want to query balance.account.id == “ckqtn3kv70003ccvh1ufbyoxv”
If i change this part to
{
balance: {
some: {
accountId,
},
},
}
to this (some to every):
{
balance: {
every: {
accountId,
},
},
}
I get empty array… is there anything similar like
balance: {
accountId = "account id I want to query "
}
windkomo
07/07/2021, 7:41 PMHalvor
07/07/2021, 9:33 PMprisma chobo
07/07/2021, 9:52 PM