Hi buddies! What’s wrong? Why userId has ‘never’ t...
# orm-help
d
Hi buddies! What’s wrong? Why userId has ‘never’ type? Meanwhile, user: {connect} works fine. This is happening when I add connection between ‘Talk’ and ‘Dialogue’. When ‘Talk’ connected only with ‘User’ model, it works fine with userId. The prisma version is 3.14
e
From what I remember, it might expect property user, not userId 🤔
d
@Elena Arens that’s really strange)
e
Did it work?
d
It offer to user userId, but next underline “data” when I select it 🤦‍♂️
r
Hi @Denis Goncharenko - try run the
prisma generate
again to make sure your stuff is up to date and then if that doesn't solve it, what happens if you try using `connect`:
Copy code
PostgreSQL.talk.create({
  data: {
    user: {connect: {id: 10}}
    //rest of your fields..
  }
});
d
@Richard Ward tried prisma generate several times. Connect working fine.
r
@Denis Goncharenko and if you run :
Copy code
PostgreSQL.talk.create({
  data: {
    userId: 10, 
    dialogueId: 1, // or a valid id
    longitude: 111,
    latitude: 111
  }
});
Does that still give you an error with the
userId
?
d
@Richard Ward
Seems it works when I use connect or ids for both
Is it feature?)
r
yes, that's how it works ..

https://files.slack.com/files-pri/T0MQBS8JG-F03FG6C4QMD/image.png▾

The types on
data
show you what it should accept .. it should work with either specifying all the id's as
scalars
or using
connect
for both
user
and
dialogue
.
d
Got it, thanks 🙏
🙂 1
r
When you try use
userId: 10
and
dialogue: { connect: {id : 1}}
then that combination matches neither of the allowed types ..
the
*Unchecked*
type puts the responsibility in your hands to ensure the id's exist ..
d
it was a mistake 😅