Chapter 20 -column "password" of relation "User" does not exist

Hi have some difficulty to find the source of the problem. Here is what I did and tried :

  • I jumped chapter 18 and 19, so my database is in the state that it should be at the end of the chapter 17
  • When I do a vapor run revert --all --yes in the terminal, I got Error: No builds found for debug configuration.
  • When I try to compile, I have the following Xcode output :

[ INFO ] Migrating ‘psql’ database (/Users/nicolas/pCloud Sync/Librairie/Electronique/iOS/Server_Side_Swift_with_Vapor_v2.1/20-cookies-sessions/starter/TILApp/.build/checkouts/fluent/Sources/Fluent/Migration/MigrationConfig.swift:69)

[ INFO ] Preparing migration ‘AdminUser’ (/Users/nicolas/pCloud Sync/Librairie/Electronique/iOS/Server_Side_Swift_with_Vapor_v2.1/20-cookies-sessions/starter/TILApp/.build/checkouts/fluent/Sources/Fluent/Migration/Migrations.swift:111)

Fatal error: Error raised at top level: :warning: PostgreSQL Error: column “password” of relation “User” does not exist
- id: PostgreSQLError.server.error.checkInsertTargets
: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1001.8.63.13/swift/stdlib/public/core/ErrorType.swift, line 200
2019-09-29 20:32:23.206764-0400 Run[61567:3125033] Fatal error: Error raised at top level: :warning: PostgreSQL Error: column “password” of relation “User” does not exist
- id: PostgreSQLError.server.error.checkInsertTargets
: file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang/swiftlang-1001.8.63.13/swift/stdlib/public/core/ErrorType.swift, line 200
Program ended with exit code: 9

This is the order of migrations :

migrations.add(model: User. self , database: .psql)
migrations.add(model: Acronym. self , database: .psql)
migrations.add(model: Category. self , database: .psql)
migrations.add(model: AcronymCategoryPivot. self , database: .psql)
migrations.add(model: Token. self , database: .psql)
migrations.add(migration: AdminUser. self , database: .psql)

What am I doing wrong ?

1 Like

Hey @nidupb :wave:

So if you want to run the revert command from the command line, you first need to run vapor build so there’s a binary to execute (that’s why you’re getting the No builds found error message).

If you do that, it should fix your issue.

(Personally I prefer just wiping away the DB in Docker instead, it’s much easier!)

when I do vapor build, it stay stuck on Building Project. Any idea why ? The log in my original post comes from Xcode when I build.

If it’s completely stuck (after waiting a few minutes) then it’s likely you have conflicting dependencies. If you run swift build --enable-pubgrub-resolver you should get better output!

And now I’m stuck on [283/291] Merging module Crypto (for at least 20 min so far, I’ll let it run for now, but still taking any ideas :slightly_smiling_face: )

Ok well that’s weird - it sounds like you’re getting stuck actually compiling the app! Is this on a MacBook or are you using something that might be low powered (like a small EC2 instance or Raspberry Pi)?

If you’re using a MacBook then definitely hop on to Vapor Discord and ask for help there!

I’m on a MacBook pro, I’ll try discord, thanks !