Chapter 9 - Error when creating user after Acronym relationship - Vapor 4

After adding the relationship between Acronym and User and clearing the database I get the following error when trying to create a user:

[ ERROR ] null value in column “userID” of relation “users” violates not-null constraint (ExecConstraints)

[ ERROR ] server: null value in column “userID” of relation “users” violates not-null constraint (ExecConstraints) [request-id: F06B265A-41C1-4050-819F-AE7DAF4190FB] (Vapor/Middleware/ErrorMiddleware.swift:42)

I tried to load the project from the provided material: Server_Side_Swift_with_Vapor_v3.0.0/09-parent-child-relationships/final/
And it gives me the same error.

Vapor 4
Apple Swift version 5.3
Xcode version 12.0.1

Can you show your code? It looks like you’ve set up the tables wrong

If it helps, I hit the same issue but realised I had accidentally added the line:

.field("userID", .uuid, .required)

to CreateUser instead of CreateAcronym.

Perhaps you’ve encountered the same? If so, run the steps to remove the docker container and delete any data as per the instructions in Chapter 9.