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: Vapor 3: Swift 5.2 Regression - Vapor - Swift Forums

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:

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

1 Like

@siggydootch Glad you fixed it! Cheers! :]

Ways to fix-

  1. Always Back Up Your Data
    This basic step is the most crucial. Humans are prone to making mistakes, and we certainly know computers aren’t perfect either. If something goes wrong, your data shouldn’t be at stake. Back up your files and create a system restore point. These two things go a long way in saving you time, frustration, and tears. Check out our guide on the best PC-saving Windows tools you must not overlook.

  2. Creating a New User Account
    Add, edit, or remove other users on Windows
    To create a new account, open search (or tap Windows key) and type user. You’ll see Add, delete, and manage other user accounts. This should take you to Other Accounts (shown below). Now click Add an account.

Add account on Windows
The next steps here are important to follow – don’t just blow through them following Microsoft’s “recommended steps”.

Instead of entering an email address, look towards the bottom of the screen and click the gray Sign in without a Microsoft account, known as a Local Account.

Add a user without a Microsoft account
In the following window, fill in the required details (username and password) and click Next. This should successfully create a new user account that is ready to use.

Add details of the user account
Your new account will only have Standard User permissions. If you want it to be an Administrator, follow these additional steps. Back at the Family & other users page, click the new user account, and then choose the Change account type option.

From here you’ll have a dropdown menu with the option to change the account from a Standard user to an Administrator.

Choose Administrator
In case this option is grayed out for you, you can switch to an administrator account via Control Panel as well. Simply open a Run dialog by pressing Win + R together. Type control.exe userpasswords in Run and click on Change your account type in the following window.

Change your account type
You can now click on the Administrator option and then hit the Change Account Type button to complete the process.

Change the account type
3. Transferring User Account Files From Old to New
You’ve created your new account and the problem you were experiencing is solved. OK, but now you need to make it like your previous account. The desktop wallpaper and theme are the easy parts that can be quickly tweaked, but what about program settings and all your personal files? When doing this from two different computers, you can use the Windows Easy Transfer tool, but transferring these files on the same machine can be done via manual copy and paste.

First, make sure your hidden files and folders are displayed as your program settings reside in the AppData folder, often hidden from view.

Once in your old User Account folder, click View and see if there is a Hidden Items checkbox (labeled with a 1 in the top image). If for some reason you don’t see it, or it doesn’t display all the hidden folders, follow number 2 in the top image by clicking Options and Change folder and search options.

Options in File Explorer
Click the View tab, find Hidden files and folders and check Show hidden files, folders, and drives.

Show hidden files and folders in the File Explorer
Keeping your old user account folder open, open a new Windows Explorer window and go to your new user account folder. You can easily find it by typing in C:\Users.

Local Disk C in the File Explorer
Select all (Ctrl+A) this folder’s contents and delete it (press Delete key).

Delete contents of the folder
Return to the old user account folder, copy all files and folders (Ctrl+A, Ctrl+C), then paste them in the new user account folder (Ctrl+V).

Paste contents in the folder
This will take some time — go refill your coffee, make a sandwich, or continue with some other work that won’t bog your computer down too much.

  1. Changing Your Username
    If you wanted to have the same account name with your new account as you did with your old one, you probably weren’t able to do so due to the old account already having the name. Once you are all settled into your new account, with your old one removed, you can change the account name pretty easily. However, make sure you are logged in with the administrator account before you proceed with the steps below.

To change the username of a local account, first, launch the Control Panel and change the View type to Large icons. Choose User accounts and then head over to Manage another account. Pick the targeted account and click on Change the account name.

Change the account name option in Control Panel
You can now enter your desired name and save the changes.

In case you wish to change the username of a Microsoft account, head over to the Microsoft website and log into your account using your email ID and password. In the following window, click on Edit name and enter your desired first and last names. Once the name of your account is changed, the changes will be reflected in your computer’s account automatically.

Rachel Gomez