I get an error when trying to create new instances when using a postgres database.
{
"error": {
"message": "relation \"public.user\" does not exist",
"name": "error",
"statusCode": "42P01"
}
}
{
"id": "string",
"username": "string",
"password": "string"
}
This might be related to https://github.com/strongloop/loopback-next/issues/1909
Pull the latest postgres
docker pull postgres:latest
run the postgres containner
docker run -d -e POSTGRES_USER=user -e POSTGRES_PASSWORD=password123 --name db-my -p 5432:5432 --restart=always postgres
Then installed the latest version of pgAdmin4 from pgadmin website
Run pgAdmin 4 create new server, and input as following Host: 127.0.0.1 Port: 5432 User name: user password: password123
done above steps.
and faced an error while running project..and error is:
Thanks @codejamninja @swarupbangaru for the feedback. Can you please look at https://loopback.io/doc/en/lb4/Database-migrations.html and run automigrate first on the models and try again?
@b-admike having the same issue (in postgres + mysql). Tried the automigration you linked, this just created an (text) column with the name of the relation (todos), but it's not loading any data from the other table.
@yvesh Are you trying to load included model instances for a hasMany relation through the todos property? If that's the case, we don't have support for inclusion yet, but it is being explored in #2124 (see #1952).
I was able to get this to work by migrating my data first. I will give a more detailed response explaining how I migrated my data.
I will give a more detailed response explaining how I migrated my data.
And then never did... 馃槩
Ooops, sorry @italodeandra. I moved on to using another framework. I don't remember the context of this problem. Loopback explains how to run migrations here.
Just out of curiosity. Which one are you using currently?
I didn't put it here because I don't want to detract from loopback. Loopback is a great framework. But, since you asked, I am using nestjs. I find it has better support for other database orm's and graphql.
I understand. You have a different use case, so I don't think it's a problem talking about an alternative solution you went for.
I, myself, give up trying to use postgres on Loopback. Most of the use cases on examples/use cases/etc works better in a NoSQL way. I'm still trying to find myself on the options. Still studying them though.
I use prisma (postgres orm) with nestjs.
Most helpful comment
I was able to get this to work by migrating my data first. I will give a more detailed response explaining how I migrated my data.