Chapter 18 - vapor run revert --all --yes not working

when I type vapor run revert --all --yes shows an error message:

[ INFO ] Migrations complete (/Users/asanchez1/Documents/TestLang/vapor/TILApp/.build/checkouts/fluent.git-1130394678472548974/Sources/Fluent/Migration/MigrationConfig.swift:73)
[Deprecated] --option=value syntax is deprecated. Please use --option value (with no =) instead.
Usage: .build/debug/Run

Commands:
boot Boots the application’s providers.
serve (default) Begins serving the app over HTTP.
routes Displays all registered routes.

Use .build/debug/Run <command> [--help,-h] for more information on a command.
Fatal error: Error raised at top level: :warning: CommandError: Unknown command revert

  • id: CommandError.unknownCommand
    : file /BuildRoot/Library/Caches/com.apple.xbs/Sources/swiftlang_Fall2018/swiftlang_Fall2018-1000.11.42/src/swift/stdlib/public/core/ErrorType.swift, line 191

I don’t know if I miss something

@bayomx you’re probably missing these lines: vapor-til/configure.swift at main · raywenderlich/vapor-til · GitHub

Thanks a lot! worked perfect :ok_hand:

1 Like

When doing this (adding command config), I’m getting the following error in Postman:

There was an error connecting to http://localhost:8080/api/v1/users/.

Why this might have happened:

  • The server couldn’t send a response:

Ensure that the backend is working properly

  • Self-signed SSL certificates are being blocked:

Fix this by turning off ‘SSL certificate verification’ in Settings > General

  • Proxy configured incorrectly

Ensure that proxy is configured correctly in Settings > Proxy

  • Request timeout:

Change request timeout in Settings > General

@0xtim Can you please help with this when you get a chance? Thank you - much appreciated! :]

@guru what do you see in the console when you start the Vapor app? It looks like it isn’t started

In Chapter 18 of the RW Book, in the database seeding section (Page 285 of the new version) , I am trying to create an Admin user as written in the book, but while adding the line migrations.add(model: AdminUser.self, database: DatabaseIdentifier<AdminUser.Database>.psql) , I am getting the error Instance method 'add(model:database:)' requires that 'AdminUser' conform to 'Model'. How to rectify this?

It should be migrations.add(migration:... not migrations.add(model:

I am still facing a similar issue

App[90344:5639062] Swift/ErrorType.swift:200: Fatal error: Error raised at top level: .unknownCommand("revert", available: ["serve", "routes", "boot", "migrate"])

In Vapor 4 the command is swift run App migrate --revert or swift run Run migrate --revert if you’re on the old template

Thank you @0xtim , this works