You can manually specify id values and not have any default like this:
id String @id
In such a case, you would have to manually specify the id field when creating a new object. If you'd like to use some arbitrary database function to generate default values for the field, you can also take a look at dbgenerated().
How to store custom ID?
Setting the default value for an id column through Prisma
Custom ID Generator as an alternative to middleware
Using prisma how to get the newly created records id(pk)?
Below is an example model where I set the id to a default value as uuid() so that I don't need to pass an id when inserting a row. However, although Supabase has uuid type which can be set to uuid_generate_v4() as default, since Prisma does not have such a type Supabase does not generate a uuid_generate_v4() for a string type.
Is there a solution to this problem? Or should I simply generate an id and pass it when inserting a row?
model Posts {
id String @id @unique @default(uuid())
createdAt DateTime @default(now())
}
I ran this as well. In order to include profile data after creating the user I did the following tweak.
const user = await prisma.user.create({
data: {
username: "username",
emailEncrypted: "encrypted",
emailIv: "iv",
password: "hashedPassword",
profile: {
create: {},
},
},
select: {
id: true,
createdAt: true,
emailConfirmed: true,
emailIv: true,
emailEncrypted: true,
isAdmin: true,
isMod: true,
password: true,
profile: true,
username: true,
},
});
This outputs,

No issue it worked fine.
Still wondering what the issue you faced was.
Can you paste the error log ?.
This is the correct way of adding relations in Prisma. You use create to add a relation and the UUID will automatically be added to that record. You do not need to do anything else. I tried the following and works fine for me:

