Typescript client generated with id as required input in Create models


#1

So I had to redeploy prisma to a fresh mysql database and all of a sudden “id” is required in the generated typescript client when I need to create a instance of any type. E.g.

This type

type Household {
id: ID! @unique
name: String!
members: [User!]! @relation(name: “HouseholdToUser”)
chores: [Chore] @relation(name: “HouseholdToChores”)
}

generates this create model:
export interface HouseholdCreateInput {
id: ID_Input;
name: String;
members?: UserCreateManyWithoutHouseholdsInput;
chores?: ChoreCreateManyWithoutHouseholdInput;
}

That is I need to provide an ID myself when creating a new household (as opposed to being auto generated which is was before).

Not sure why this is happening at the moment…


#2

I finally found the reason - I had: databaseType: document in my prisma.yml - file even though I was using a sql database. Removing “databaseType: document” solved the issue.

(I had dabbled with switching to a cosmos db prior and forgotten to remove this config)