Austin
07/18/2022, 9:34 AMprisma.$transaction, but the problem is that all subsequent queries need to be transaction-aware (and so needs to use the prisma object provided by the $transaction callback). This means I need to control the prisma object being passed to my backend functions so that instead of the normal client, they get the transaction-aware client. Is there some clever way to do this?
The docs recommend mocking but I would strongly prefer transaction-rollback testing my backend functions. Any recommendations from the community? Thank you 🙏Brothak
07/18/2022, 9:39 AMmodel User {
  id              Int       @id @default(autoincrement())
  name            String
  description    String
}
I would expect to be able to update User description by running:
prisma.name.update({
      where: {
        name,
      },
      data: {
        description: 'Update'
      },
    });Brothak
07/18/2022, 9:41 AMexport type UserWhereUniqueInput = {
    id?: number
  }Kay Khan
07/18/2022, 9:52 AMError: Get Config: Unable to establish a connection to query-engine-node-api library. It seems there is a problem with your OpenSSL installation!
Details: Unable to require(`/home/kay/checkpoint/nft-api/node_modules/@prisma/engines/libquery_engine-debian-openssl-1.1.x.so.node`)
 libssl.so.1.1: cannot open shared object file: No such file or directory
Prisma CLI Version : 4.0.0
whereis node
node: /home/kay/.nvm/versions/node/v16.16.0/bin/node
whereis openssl
openssl: /usr/bin/openssl /home/linuxbrew/.linuxbrew/bin/openssl /usr/share/man/man1/openssl.1ssl.gz
any ideas?user
07/18/2022, 10:08 AMwindkomo
07/18/2022, 1:53 PMOFFSET x ROWS . I don’t need it so I just want to delete this part.Maguire Krist
07/18/2022, 4:40 PMVanessa Kroeker
07/18/2022, 8:01 PMprisma migrate dev) after squashing migrations.
Here's what I'm doing:
1. Squash migrations (following Prisma's guide on squashing migrations to create a clean history in a production environment: https://www.prisma.io/docs/guides/database/developing-with-prisma-migrate/squashing-migrations#how-to-create-a-clean-his[…]-a-production-environment), including marking the migration as applied
2. Make a change to schema.prisma
3. Run prisma migrate dev to create a new migration
4. Make another change to schema.prisma
5. Run prisma migrate dev to create another new migration
6. Migration fails with following error: 
Error: P3006
Migration `20220718195944_migration_name` failed to apply cleanly to the shadow database. 
Error code: P1014
Error:
The underlying table for model `users` does not exist.
The same thing will happen if I run the first migration generation after squashing with `--create-only`: when I then subsequently try to run prisma migrate dev to apply the created migration, the same error message as above will come up.
Creating/applying these migrations works fine as long as the previous migrations haven't been squashed. This is only happening after squashing. So I understand that I can revert back to the pre-squashed migration history and reset from there, but if squashing migrations is an option - and it's one we want to use -  it shouldn't block further migrations from being created and applied.
Any help/advice is greatly appreciated, thank you!
UPDATE: This only happens when following the documented instructions for creating a clean history in a production environment, ie. by creating the squashed_migrations directory with the following command
npx prisma migrate diff \
 --from-empty \
 --to-schema-datamodel ./prisma/schema.prisma \
 --script > ./prisma/migrations/squashed_migrations/migration.sql
rather than creating it by running prisma migrate dev --name squashed_migrations.Roryl
07/18/2022, 10:26 PMRoryl
07/18/2022, 10:26 PMRoryl
07/18/2022, 10:27 PMYeonHoPark
07/19/2022, 1:14 AMgetUser  must return a value containing only information about the select object received as an argument. and it must be type safe !Tri Nguyen
07/19/2022, 2:11 AMconst post = await prisma.post.findFirst({...});
// continue playing with post
post.update({...})Yunbo
07/19/2022, 3:28 AM.env ?
i'd like to use .env.test .<http://env.dev|env.dev> .env.local and so on.
but prisma seems like only taking .envMark
07/19/2022, 10:24 AMTom Ashford
07/19/2022, 11:44 AMmodel User {
	...
    profile   Profile @relation(fields: [profileID], references: [id])
    profileID Int     @unique
}
model Profile {
    ...
    user User?
}
I'm ensuring I can't create a User without a Profile, but that way a Profile won't get deleted if a User is deleted, right? Currently I have it the other way around so I get the cascades but then I can't require the creation of the Profile, which I'd really like to be able to do as I have a bunch of structures like this. Cheersalexwasik
07/19/2022, 12:04 PMautoincrement should work. Using Cockroach DB with Prisma
Move model
model Move {
  id        BigInt   @id @default(autoincrement())
  matchId   Stringalexwasik
07/19/2022, 12:05 PMautoincrement, shouldn't the numbers be sequential?Arpan Bagui
07/19/2022, 12:10 PMKatarzyna Zarnowiec
07/19/2022, 12:51 PMuser
07/19/2022, 1:30 PMShadee Merhi
07/19/2022, 2:50 PMConversations , ConversationParticipants, and Users. The relationship between Users and Conversations is many-to-many, hence the creation of the ConversationParticipant model.
Here is my schema:
model User {
  id             String    @id @default(auto()) @map("_id") @db.ObjectId
  name           String?
  email          String? @unique
  username       String  @unique
  messages       Message[]
  conversations  ConversationParticipants[]
  createdAt      DateTime  @default(now())
  updatedAt      DateTime  @updatedAt
}
model Conversation {
  id              String    @id @default(auto()) @map("_id") @db.ObjectId
  participants    ConversationParticipants[]
  messages        Message[]  @relation("conversationMessages")
  latestMessage   Message?   @relation(name: "latestConversationMessage", fields: [latestMessageId], references: [id], onUpdate: NoAction, onDelete: NoAction)
  latestMessageId String?    @unique
  createdAt       DateTime  @default(now())
  updatedAt       DateTime  @updatedAt
}
model ConversationParticipants {
  id              String    @id @default(auto()) @map("_id") @db.ObjectId
  conversation    Conversation @relation(fields: [conversationId], references: [id])
  conversationId  String
  user            User      @relation(fields: [userId], references: [id])
  userId          String
}
model Message {
  id              String        @id @default(auto()) @map("_id") @db.ObjectId
  conversation    Conversation  @relation(name: "conversationMessages", fields: [conversationId], references: [id])
  conversationId  String
  isLatestIn      Conversation? @relation("latestConversationMessage")
  sender          User          @relation(fields: [senderId], references: [id])
  senderId        String
  body            String
  createdAt       DateTime      @default(now())
  updatedAt       DateTime      @updatedAt
}
When the user signs in, I am trying to find all of the users conversations (i.e. all of the conversations where there is an existing ConversationParticipant entity).
My current query is the following:
// the user id comes from the session - working properly
const { id } = session;
const conversations = await prisma.conversation.findMany({
    where: {
      participants: {
        some: {
          userId: {
            equals: id,
          },
        },
      },
    },
    include: {
      participants: true,
    },
});
All of the similar scenarios I can find online are all using the some operator as well, so I am not sure why this isn’t working. I must be missing something 😅
Any and all help would be greatly appreciated!paresh solanki
07/19/2022, 4:52 PMparesh solanki
07/19/2022, 4:52 PMparesh solanki
07/19/2022, 4:55 PMAlex Okros
07/19/2022, 5:11 PM@prisma/migrate with @prisma/internals as a peer dependency giving an error stating “Error: Cannot find module ‘fp-ts/TaskEither’“? I tried installing fp-ts as a peer dependency, but it doesn’t seem to be doing anything for the error.Ivan Lukianchuk
07/19/2022, 7:12 PMprisma:error Error while querying: This request must be retried
{
timestamp: undefined,
message: 'Error while querying: This request must be retried',
target: undefined
}
[...omitted 10x repeats of above]
{
timestamp: undefined,
message: 'This request can be retried',
target: undefined
}
> [...omitted 10x repeats of above]
Dev__
07/20/2022, 6:55 AMenv variable cannot be found.
this is the folder structure on the docker
.env
dist
  /scripts
    script.js
node_modules
prisma
  /migrations
  schema.prisma
  seed.ts
the script files that I am running is script.js > node scripts.js <arg>
it is available in the .env thoHussam Khatib
07/20/2022, 9:08 AMprisma.$queryRaw` 
// template string used in the raw sql query
 `nikolasburk