Laurynn Lowe
05/19/2022, 12:50 AMfooInstance.setBar().
Matt Fysh
05/19/2022, 5:13 AMMatt Fysh
05/19/2022, 8:48 AMprisma migrate
and then checking in only the migration files and not the new schema?FUTC
05/19/2022, 10:54 AMGeebrox
05/19/2022, 11:26 AMtype
object in the schema file? It doesn’t include type
in the generated schema.
session.model.schema:
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
model Session {
id String @id @default(auto()) @map("_id") @db.ObjectId
sessionId String @unique
shop String
state String
isOnline Boolean
scope String
expires DateTime?
accessToken String
onlineAccessInfo SessionOnlineAccessInfo?
}
type SessionOnlineAccessInfo {
expires_in Int
associated_user_scope String
associated_user SessionAssociatedUser
}
type SessionAssociatedUser {
id Int
first_name String
last_name String
email String
email_verified Boolean
account_owner Boolean
locale String
collaborator Boolean
}
Generated schema file (aurora):
// ◮◮◮ GENERATED BY AURORA ◮◮◮
datasource db {
provider = "mongodb"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
model Session {
id String @id @default(auto()) @map("_id") @db.ObjectId
sessionId String @unique
shop String
state String
isOnline Boolean
scope String
expires DateTime?
accessToken String
onlineAccessInfo SessionOnlineAccessInfo?
}
Berian Chaiwa
05/19/2022, 2:45 PMLuan Rodrigues
05/19/2022, 2:49 PMmodel card {
id Int @id @default(autoincrement())
name String? @db.VarChar(100)
position Int?
tags tags[] @relation("card_tags")
}
model tags {
id Int @id @default(autoincrement())
name String? @db.VarChar(100)
color String? @db.VarChar(100)
cards card[] @relation("card_tags")
}
When I try to restrict the onDelete action it shows this error
tags tags[] @relation("card_tags", onDelete: Restrict) // ''Error validating: Referential actions on implicit many-to-many relations are not supported''
Any tip to proceed with this situation? Thanks!!Chris Tsongas
05/19/2022, 9:31 PMfullName
column similar to this post https://github.com/prisma/prisma/discussions/8891 with the following Prisma schema (abbreviated here for clarity):
model Employee {
id String @id @default(uuid()) @db.Uuid
firstName String
preferredFirstName String?
lastName String
fullName String?
}
I have a trigger that computes the full name based on the required first name, optional preferred first name, and required last name, so there will ALWAYS be a full name value. Trouble is, if I make fullName
not null, then Prisma requires it to be passed in, which I don't want to do. If I make fullName
nullable as shown above, then I can't make it required in my GraphQL schema because Prisma says it could be null, which is inaccurate because the trigger always gives it a value. Any ideas?Jared Delapasse
05/19/2022, 10:49 PMNathan Lands
05/19/2022, 10:54 PMNorbert Takács
05/20/2022, 12:07 AMdb pull
✅
4. added script that runs npx prisma migrate deploy
on deploy ✅
5. deploy new migration on production 📛
I get the following error:
Error: P3009
migrate found failed migrations in the target database, new migrations will not be applied. Read more about how to resolve migration issues in a production database: <https://pris.ly/d/migrate-resolve>
The `20220503190343_multichat` migration started at 2022-05-19 23:57:48.448 UTC failed with the following logs:
Looking into the migration that was generated it added steps that are not necessary. How would I create a migration when developing.
As in how would I create a migration from STATE1 to STATE2 without the ORIGINAL_DB_STATE. So the migration only includes the last changes done to the DB (in my case adding a table). As db pull
does not seem to be the answer because it creates a full migration from 0. If anyone could link me to a dev workflow with prisma that would really helpJacob Simon
05/20/2022, 12:34 AMJacob Simon
05/20/2022, 12:37 AMJacob Simon
05/20/2022, 12:38 AMMischa
05/20/2022, 5:38 AMmkspcd
05/20/2022, 5:57 AMDate
(YYYY-MM-DD), not DateTime
?Jason Kleinberg
05/20/2022, 12:36 PMLen Smith
05/20/2022, 2:42 PMupdatedAt
in Prisma. Curious on thoughts of this solution (I do realize I’m missing updateMany
here). Is there a better or more idiomatic way to solve keeping these dates in sync?Luke Brown
05/20/2022, 3:46 PMMay 20, 04:30:02 PM: 96fdf0db ERROR PrismaClientKnownRequestError:
Invalid `prisma.deployment.findFirst()` invocation:
Client network socket disconnected before secure TLS connection was established
at Object.request (/var/task/node_modules/@prisma/client/runtime/proxy.js:94:56)
at t._request (/var/task/node_modules/@prisma/client/runtime/proxy.js:111:1462)
at loader9 (/var/task/.netlify/functions-internal/server.js:444240:18)
at Object.callRouteLoader (/var/task/.netlify/functions-internal/server.js:22913:18)
at handleDataRequest (/var/task/.netlify/functions-internal/server.js:25968:22)
at requestHandler (/var/task/.netlify/functions-internal/server.js:25900:22)
at Runtime.handler (/var/task/.netlify/functions-internal/server.js:27121:24) {
code: 'ECONNRESET',
clientVersion: '3.14.0',
meta: undefined
}
Is this error coming from Prisma?James
05/20/2022, 4:14 PMprisma chobo
05/20/2022, 5:00 PMprisma.item.findFirst({
where: {
id: "....",
deletedAt: null,
}
})
But if I remove deletedAt, I get what I want. Am I approaching in wrong way?
My schema is
model Item {
id String @id @default(auto()) @map("_id") @db.ObjectId
name String
type String?
extendedName String
provider String?
summary String?
destinationCountry Country
description String
remark String?
amount Float
gpoint Float?
gpointAmount Float?
display Boolean
discountRate Int?
notes Note[]
imageUrl String
state State
createdBy String
expiresAt Int
brand String
category String
order Order?
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
deletedAt Int?
@@index([category])
@@index([brand])
@@index([name])
@@index([provider])
}
Tomáš
05/20/2022, 6:11 PMTomáš
05/20/2022, 6:15 PMRahul Taing
05/20/2022, 8:12 PMnode_modules/.prisma/client/index".Prisma' has no exported member modelNameCreateInput
Chip Clark
05/20/2022, 9:30 PMClientNumber
to type Int
.
The database has a ClientNumber, but it's a string with spaces at the end.
I can convert the Parameter to an int, but it doesn't work.
Controller:
@Get(`${Route}/client/:id`)
byclient(@Param('id') id: number ) {
let tempID = id.toString();
tempID = tempID.slice(0,6);
return this.MatterService.MatterbyClient(+tempID);
}
I have also tried:
@Get(`${Route}/client/:id`)
byclient(@Param('id') id: string ) {
let tempID = id.slice(0,6);
return this.MatterService.MatterbyClient(+tempID);
}
Service:
MatterbyClient( clientid: any) {
return Promise.all([
this.prisma.matter.findMany({
where: { ClientNumber: clientid },
select: defaultSelectQuery
})
}
Schema:
model Matter {
MatterPKID Int @id @default(autoincrement())
ClientNumber String @db.VarChar(16)
MatterNumber String @db.VarChar(16)
MatterUno Int
ClientUno Int
MatterName String @db.VarChar(250)
MatterDescription String? @db.VarChar(Max)
OpenDate DateTime? @db.Date
CloseDate DateTime? @db.Date
@@index([ApprovalDate], name: "ncl_Matter_ApprovalDate")
@@index([ClientNumber], name: "ncl_Matter_ClientNumber")
}
I've tried setting the schema: ClientNumber Int
but with no success.Rajkumar
05/20/2022, 9:53 PMRajkumar
05/20/2022, 9:54 PMRajkumar
05/20/2022, 9:54 PMAaron Waller
05/21/2022, 9:21 AMconst assignCategories = await prisma.post.create({
data: {
title: 'First Post Title',
categories: {
create: [
{
category: {
create: {
name: myStringArray[0],
},
},
},
{
category: {
create: {
name: myStringArray[1],
},
},
},
],
},
},
})
Here the Array:
const myStringArray = ["Category1", "Category2", "Category3"];
Richard Wu
05/21/2022, 4:37 PM