#Can’t create data model relationship

1 messages · Page 1 of 1 (latest)

polar nova
#

I Created a Data model with AWS Amplify.

I’m following a tutorial and in the tutorial. In the tutorial there is a relation created in the video table. I did one video to one user.

The issue is whenever I try to create a relationship in the user model I am not able to do the same which is create a one user to many videos. I only have two options now.

#1019643921137139772

#

Can’t create data model relationship

dusk bridge
#

you already created relationships between Video and users! why you are creating again with Users to video?

polar nova
polar nova
tawny tinsel
#

You should be able to click on "add relationship" on user and add a one user to many videos relationship

#

@polar nova

polar nova
#

Wait I’m confused I was not able to get that relationship

tawny tinsel
#

I just tried it on my console. Very simple.

polar nova
#

Whenever I try I get this relationship

tawny tinsel
#

Let me see your video data model

polar nova
tawny tinsel
#

Remove the user relationship

#

Then add relationship on the user data model

#

it SHOULD allow you to add one user to multiple videos

polar nova
tawny tinsel
#

Nope

#

Now that I think about it, it should work regardless.

#

But you can't add User -> Multiple Videos relationship
and then add Video -> multiple users relationship because you've already created that sort of relaitonship in a datamodel

polar nova
#

Ok I understand so if I had to change it if I want users to be able to upload multiple videos what would I need to do?

tawny tinsel
#

I believe it'll work both ways once you make the relationship

#

so i don't think it'll matter who has it ( i believe)

polar nova
tawny tinsel
#

then try adding the relationship to the user data model not the video

polar nova
polar nova
tawny tinsel
#

😉