Akash Anand
01/23/2022, 9:53 AMAdrian
01/23/2022, 10:26 AMAdrian
01/23/2022, 10:27 AMLars Ivar Igesund
01/23/2022, 10:32 AMLars Ivar Igesund
01/23/2022, 10:32 AMAdrian
01/23/2022, 10:39 AMLars Ivar Igesund
01/23/2022, 10:43 AMManish
01/23/2022, 11:48 AMconst users = await prisma.user.findMany({
  include: {
    posts: true
  },
})Rich Starkie
01/23/2022, 5:14 PMprisma.<table>.<action>Salvage
01/23/2022, 7:08 PMLars Ivar Igesund
01/23/2022, 7:33 PMSalvage
01/23/2022, 7:50 PMRaj Chaudhary
01/24/2022, 5:46 AMmodel User {
  id BigInt @id
  createdAt DateTime @db.Timestamptz(3) @default(now())
  updatedAt DateTime @db.Timestamptz(3) @updatedAt
  accountId BigInt
  account Account @relation(fields: [accountId], references: [id])
  fullName String
  email String
  oauthToken String?
}CREATE TABLE "User" (
    "id" BIGINT NOT NULL,
    "createdAt" TIMESTAMPTZ(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
    "updatedAt" TIMESTAMPTZ(3) NOT NULL,
    "accountId" BIGINT NOT NULL,
    "fullName" TEXT NOT NULL,
    "email" TEXT NOT NULL,
    "oauthToken" TEXT,
    CONSTRAINT "User_pkey" PRIMARY KEY ("id")
);Thibaut De Maerteleire
01/24/2022, 7:58 AMHubert Kowalski
01/24/2022, 8:35 AMNathaniel Bajo
01/24/2022, 10:10 AMNathaniel Bajo
01/24/2022, 10:11 AMNathaniel Bajo
01/24/2022, 10:12 AMNathaniel Bajo
01/24/2022, 10:12 AMNathaniel Bajo
01/24/2022, 10:13 AMNathaniel Bajo
01/24/2022, 10:13 AMNathaniel Bajo
01/24/2022, 10:14 AMNathaniel Bajo
01/24/2022, 10:15 AMgit clonedNathaniel Babalola
01/24/2022, 10:38 AMElijah Rosier
01/24/2022, 10:50 AMnumber{ _count: { _all: 14 } }prisma.sentimentResponse.count({
        where: {
          contentId: pathParameters.contentId,
        },
      })Nathaniel Babalola
01/24/2022, 11:29 AMAlexSPx
01/24/2022, 11:31 AMmodel Course {
  name        String  @id @unique
  public_name String?
  details     Json?
  published   Boolean @default(false)
  model ModelType @default(WEEKLY)
  weeks Int?
  // Relation Fields
  members    CourseEnrollment[]
  dataModels CourseDataModel[]
  @@map("course")
}
model CourseDataModel {
  id    String   @id @default(uuid())
  name  String
  type  DataType
  props Json
  // Relation Fields
  document_id   String?     @unique
  document      Document?   @relation(fields: [document_id], references: [id], onDelete: Cascade)
  video_id      String?     @unique
  video         Video?      @relation(fields: [video_id], references: [id], onDelete: Cascade)
  course_id     String
  course        Course      @relation(fields: [course_id], references: [name], onDelete: Cascade)
  assignment_id String?     @unique
  assignment    Assignment? @relation(fields: [assignment_id], references: [id], onDelete: Cascade)
  quiz_id String? @unique
  quiz Quiz? @relation(fields: [quiz_id], references: [id], onDelete: Cascade)
  @@map("courseDataModel")
}AlexSPx
01/24/2022, 11:31 AMconst courses = await prismaClient.course.findMany({
      where: {
        published: true
      },
      select: {
        name: true,
        public_name: true,
        details: true,
        weeks: true,
      },
      include: {
        _count: {
          select: {
            dataModels: {
              where: {...}
            }
          }
        }
      }
    })Stijn
01/24/2022, 12:59 PMInvalid `prisma.project.update()` invocation:
  The change you are trying to make would violate the required relation 'ProjectToUserProject' between the `Project` and `UserProject` models.
details:
{
  code: 'P2014',
  clientVersion: '3.8.1',
  meta: {
    relation_name: 'ProjectToUserProject',
    model_a_name: 'Project',
    model_b_name: 'UserProject'
  }
}model UserProject {
  projectId Int
  project   Project @relation(fields: [projectId], references: [id], onDelete: Cascade)
  userId    Int
  user      User    @relation(fields: [userId], references: [id], onDelete: Cascade)
  @@id([userId, projectId])
}
model Project {
  id         Int       @id @default(autoincrement())
  name       String
  users  UserProject[]
}const project = await db.project.update({
  where: { id },
  data: {
    ...data,
    users: {
      set: users?.map(user => ({
        userId_projectId: {
          userId: user.userId,
          projectId: id,
        },
      }))
    }
  },
})Shmuel
01/24/2022, 8:54 PMbeforeEach(async () =>  {
  await prisma.$queryRaw`BEGIN TRAN`;
});
afterEach(async () => {
  await prisma.$queryRaw`ROLLBACK TRAN`;
});Raw query failed. Code: `266`. Message: `Transaction count after EXECUTE indicates a mismatching number of BEGIN and COMMIT statements. Previous count = 1, current count = 0.`