Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryFailedError: relation "auth_user_entity" does not exist #13

Open
phuonghust2110 opened this issue May 19, 2023 · 0 comments
Open

Comments

@phuonghust2110
Copy link

phuonghust2110 commented May 19, 2023

I am using typeORM and i have an AuthUserEnity `import { BaseEntity, Column, Entity, PrimaryGeneratedColumn } from "typeorm";

@entity()
export class AuthUserEntity {
@PrimaryGeneratedColumn()
public id: number;

@column()
public email :string;

@column()
public password :string;

@Column()
public salt : string

}`

and in AppModule : `import { Module } from "@nestjs/common";
import { ConfigModule, ConfigService } from "@nestjs/config";

import { TypeOrmModule } from "@nestjs/typeorm";
import { AuthUserEntity } from "./auth/auth.user.entity";
import { AuthModule } from "./auth/auth.module";

@module({
imports: [
ConfigModule.forRoot({ isGlobal: true }),
TypeOrmModule.forRootAsync({
imports: [ConfigModule],
inject: [ConfigService],
useFactory: (configService: ConfigService) => ({
type: 'postgres',
host: configService.get('POSTGRES_HOST'),
port: configService.get('POSTGRES_PORT'),
username: configService.get('POSTGRES_USER'),
password: configService.get('POSTGRES_PASSWORD'),
database: configService.get('POSTGRES_DB'),
entities: [AuthUserEntity],
synchronized: true
})
}),
AuthModule
],
controllers: [],
providers: []
})

export class AppModule {

}`

and in AuthModule : `import { Module } from "@nestjs/common";
import { TypeOrmModule } from "@nestjs/typeorm";
import { AuthUserEntity } from "./auth.user.entity";
import { JwtStategy } from "./auth.stategy";
import { AuthService } from "./auth.service";
import { AuthController } from "./auth.controller";
import { JwtModule } from "@nestjs/jwt";

@module({
imports: [JwtModule.register({
secret : 'iloveyou',
signOptions : {expiresIn : "1h"}
}),
TypeOrmModule.forFeature([AuthUserEntity])],
providers: [AuthService, JwtStategy],
controllers : [AuthController],
exports: [AuthService]
})

export class AuthModule{

}`

I'm try to you postman to post data and I'm getting an error " relation "auth_user_entity" does not exist" Does anyone know how to fix this? Thanks very much !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant