Halvor
06/16/2021, 3:48 PMNatalia
Halvor
06/16/2021, 4:16 PMHalvor
06/16/2021, 4:18 PMHalvor
06/16/2021, 4:18 PMFilippo Sarzana
06/16/2021, 5:50 PMAndrew Hollenbach
06/16/2021, 9:43 PMprisma 2.23.0 -> 2.24.0. Has anyone encountered this? I can include more details if necessary. Note that this only happens when upgrading prisma and not @prisma/client, which is fine at 2.24+
== Dockerfile
<...>
RUN yarn install
RUN yarn run build:js
RUN dotenv -e .env.development -- yarn prisma generate
== Output
 > [10/10] RUN dotenv -e .env.development -- yarn prisma generate:
#14 0.645 yarn run v1.22.5
#14 0.705 $ /node_modules/.bin/prisma generate
#14 1.355 Environment variables loaded from .env
#14 2.070 Prisma schema loaded from prisma/schema.prisma
#14 3.659 [1/4] Resolving packages...
#14 4.129 [2/4] Fetching packages...
#14 5.198 info fsevents@2.3.2: The platform "linux" is incompatible with this module.
#14 5.198 info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
#14 5.230 [3/4] Linking dependencies...
#14 8.626 [4/4] Building fresh packages...
#14 8.799 success Saved 0 new dependencies.
#14 9.336 [1/4] Resolving packages...
#14 9.845 [2/4] Fetching packages...
#14 10.86 info fsevents@2.3.2: The platform "linux" is incompatible with this module.
#14 10.86 info "fsevents@2.3.2" is an optional dependency and failed compatibility check. Excluding it from installation.
#14 10.89 [3/4] Linking dependencies...
#14 14.33 [4/4] Building fresh packages...
#14 14.53 success Saved 0 new dependencies.
#14 14.62 Error: Could not resolve @prisma/client despite the installation that we just tried.
#14 14.62 Please try to install it by hand with npm install @prisma/client and rerun yarn prisma generate :pray:.
#14 14.65 error Command failed with exit code 1.
#14 14.65 info Visit <https://yarnpkg.com/en/docs/cli/run> for documentation about this command.Tom
06/17/2021, 5:49 AMJest did not exit one second after the test run has completed.  I also thought that the singleton would kind of "mock" the database, but the user still gets created in the real database. What is wrong here?
Edit: The warning doesn't show up if I call await prisma.$disconnect();tim2
06/17/2021, 7:12 AMHenri Kuper
06/17/2021, 9:18 AMis and isNot syntax. Is this documented somewhere? I couldn’t find it in the prisma docs. (Maybe I just missed it?)
Thanks to the whole prisma team, for creating such a great productprisma rainbowBenjamin Kroeger
06/17/2021, 10:08 AMDev__
06/17/2021, 11:33 AMmodel Element {
    id        String   @id @db.VarChar(255)
    element   String   @db.VarChar(255)
    parentId  String?  @db.VarChar(255)
    required  Boolean  @db.Boolean
    createdAt DateTime @default(now()) @db.Timestamptz
    updatedAt DateTime @updatedAt @db.Timestamptz
    parent PoomElement? @relation("ParentElement", fields: [parentId], references: [id])
}
after I save the auto format of prisma adds another relation which I dont want
Element Element[] @relation("ParentElement")
is that above relation necassary?  In the docs I see its not required: https://www.prisma.io/docs/concepts/components/prisma-schema/relations#one-to-one-self-relationsEdward Baer
06/17/2021, 3:35 PMcreatedAt DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    updatedAt DATETIME(3) NOT NULL,
    deletedAt DATETIME(3),
But I need this:
createdAt DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
    updatedAt DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    deletedAt DATETIME(3),Michael
06/17/2021, 4:50 PM2.23.0 - is there a way to cast the value of a "path"?
For example our JSON in Postgres has string values for all paths - but we want to say convert that on the fly to a Postgres int to do <, <=, > ect comparisons?  To solve this we are doing RAW prisma sql, but was wondering if there was features (or features in the future) that could address this.Wilson
06/18/2021, 12:53 AMIbrahim
06/18/2021, 2:29 AMKeshav Ray
06/18/2021, 4:40 AMAlbert Gao
06/18/2021, 5:30 AMSylvain (seel-vahn)
06/18/2021, 5:39 AMschema.prisma files locally (without having to run migrate commands) and directly output the result as SQL (such as: prisma diff schema1.prisma schema2.prisma --sql).
By any chance - any undocumented way to achieve this? Or is the migration engine tightly coupled to the database itself, as opposed to the schema files?Danila Pavliuk
06/18/2021, 6:04 AMDanila Pavliuk
06/18/2021, 6:06 AMSylvain (seel-vahn)
06/18/2021, 6:30 AMMattias Ottosson
06/18/2021, 8:22 AMmodel Claim {
  id              Int       @id @default(autoincrement())
  customerName    String
  customerId      String
  contactPerson   String
  phone           String
  email           String
  orderId         String
  reference       String
  comment         String?
  createdAt       DateTime  @default(now())
  status          Status    @default(NEW)
  articles        Article[]
}
enum Status {
  NEW
  PROCESSING
  COMPLETED
}
await prisma.claim.findMany({
  include: {
    articles: true
  }
});
{
  id: 1,
  customerName: 'Name',
  customerId: 'Id',
  contactPerson: 'Person',
  phone: '049010000',
  email: '<mailto:email@mail.se|email@mail.se>',
  orderId: 'test123',
  reference: 'ref123',
  comment: 'Not bad',
  createdAt: 2021-06-17T18:26:36.529Z,
  articles: [ [Object] ]
}Manish
06/18/2021, 1:09 PMmodel Post {
  id        Int     @default(autoincrement()) @id
  title     String
  content   String?
  items     ItemsOnPosts[]
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
}
model Item {
  id     Int     @id @default(autoincrement())
  name   String
  posts  ItemsOnPosts[]
}
model ItemsOnPosts {
  post        Post     @relation(fields: [postId], references: [id])
  postId      Int      // relation scalar field (used in the `@relation` attribute above)
  item    Item @relation(fields: [itemId], references: [id])
  itemId  Int      // relation scalar field (used in the `@relation` attribute above)
  @@id([postId, itemId])
  notes   String?
  order   Int
}
The items within a post are ordered as per the order field in ItemsOnPosts.
The problem arises when I want to add/ a new item in the the list, or want to change the order of items in a post.
So, let’s say that a post (with id 1) has six items, with order as below.
postId  itemId  order
------  ------  -----
1       x       0 
1       x       1
1       x       2
1       x       3
1       x       4
1       x       5
2       x       0 
2       x       1
2       x       2
2       x       3
Two scenarios:
- Add a new item to post 1 between 2 and 3. So this new item will become order number 3 and the order number of all items after will need to be incremented by 1.
- Add a new item at the end. This would require me to get the order number of the last item in that post and then increment it by 1, i.e., 6.
I know this is not a Prisma related problem. But I’m looking for the best way to maintain/update/handle these ordering of items in the post. Any insight/best practice is appreciated.Nole Stock
06/18/2021, 1:29 PMItems table and a Sales . I want the Sales table to represent sold items but be able to have some different fields if the sale is on a different platform. I was thinking maybe just have different types of Sales tables but then Items would have a number of possible unused relations. I've used raw SQL before and designed some toy databases but never prisma. Does anyone have any advice on how to proceed?
Here's my schema so far:
model Item {
  id        Int      @id @default(autoincrement())
  createdAt DateTime @default(now())
  updatedAt DateTime @updatedAt
  name      String
  desc      String?
  quality   String?
  quantity  Int      @default(1)
  sale      Sale     @relation(fields: [saleId], references: [id])
  saleId    Int // relation scalar field (used in the `@relation` attribute above)
}
model Sale {
  id          Int      @id @default(autoincrement())
  createdAt   DateTime @default(now())
  updatedAt   DateTime @updatedAt
  boughtPrice Decimal
  item        Item?
  platform    String //Enum on postgress EBAY,MERCARI,ETC
}David Chalifoux
06/18/2021, 6:40 PMupsert, but Prisma is throwing an error whenever a related Model is referenced in the query ("Unknown arg"). The VSCode extension shows no error, so I am not sure why this wouldn't work. Any ideas?Ighor Martins
06/18/2021, 6:50 PMLars Ivar Igesund
06/18/2021, 6:52 PMIghor Martins
06/18/2021, 6:55 PM