Setting Relational Attribute in gql mutation

Hi- I’m trying to set a relational field in a gql mutation. I’m creating a new trip in this mutation and need it to be attached to a specific tail number. Tail Numbers can have multiple trips, and trips can only have one tail number. Here is the mutation I wrote:
const CREATE_TRIP_MUTATION = gql
mutation createTrip(
$StartDate: Date!
$EndDate: Date!
$Routing: String!
$CabinAttendantName: String!
$Feedback: String!
$CateringDetails: String!
$tail_number: ID!
)
{
createTrip(
data: {
StartDate: $StartDate
EndDate: $EndDate
Routing: $Routing
CabinAttendantName: $CabinAttendantName
Feedback: $Feedback
CateringDetails: $CateringDetails
tail_number: $tail_number
}
) {
data {
attributes {
StartDate
EndDate
Routing
CabinAttendantName
Feedback
CateringDetails
tail_number {
data {
attributes {
TailNumber
}
}
}
}
}
}
}
;
I am getting the message back “foreign key constraint failed.” I can create the trip on its own with no tail number attached successfully, however I need to have the relational component. Thanks!