chapter many to many relationships … adding foregin keys
when running the app give me run error hread 1: Fatal error: Error raised at top level: PostgreSQL Error: relation "User" does not exist
xcode tell
[ INFO ] Migrating 'psql' database (/Users/Mercury/Desktop/vapor/tilm/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/MigrationConfig.swift:69)
[ INFO ] Preparing migration 'Acronym' (/Users/Mercury/Desktop/vapor/tilm/.build/checkouts/fluent.git-6251908308727715749/Sources/Fluent/Migration/Migrations.swift:111)
You need to change the order of your migrations and put the User first. Currently it tries to run the acronym migration which refers to a User but it doesn’t know about that yet
Quick fix
PostgreSQL error 42501 is a common error that sometimes occurs in response to a PostgreSQL database query. In most cases, error code 42501 implies that the user has insufficient privilege for the database. As soon as a user with insufficient privileges make a query, PostgreSQL responds with the error message.
To fix the problem, check the database user privileges. If the user who attempted the query lacks permission, simply change the privileges accordingly. You can give privileges for a table either to the public using “GRANT SELECT ON table_name TO PUBLIC;” or to only a few users using the command “GRANT SELECT ON table_name to user_name;”.