Group Group Group Group Group Group Group Group Group

Chapter 9: Saving New User Error

Hello! I’m loving the book so far but have run into the following error when trying to create new user (Page 112). Can you please help?
[ ERROR ] PostgreSQLError.server.error.parserOpenTable: relation “User” does not exist (ErrorMiddleware.swift:26)

Please note: my migrations are as follows (differ from the book due to Swift update):

migrations.add(model: User. self , database: DatabaseIdentifier<User.Database>.psql)

migrations.add(model: Acronym. self , database: DatabaseIdentifier<Acronym.Database>.psql)

Thanks in advance for the help!

Hey just wanted to give an update that I updated my migrations as per the article here: https://forums.swift.org/t/vapor-3-swift-5-2-regression/34764

They now appear as:
migrations.add(model: User. self , database: DatabaseIdentifier.psql)

migrations.add(model: Acronym. self , database: DatabaseIdentifier.psql)

I’m still getting the same error when I try to POST(create) a new user:
[ ERROR ] PostgreSQLError.server.error.parserOpenTable: relation “User” does not exist (ErrorMiddleware.swift:26)

This is the error received in docker:
2020-06-25 01:18:00.920 UTC [34] ERROR: relation "User" does not exist at character 13

2020-06-25 01:18:00.920 UTC [34] STATEMENT: INSERT INTO "User" ("name", "username", "id") VALUES ($1, $2, $3) RETURNING *

Thanks in advance for the help!

Ok I just figured out I hade deleted the following line from my configure file lol:
services.register(migrations)

I have re-added it and the issue is fixed. Thanks!

1 Like