Skip to content

Primary Key not being named "id"  #33

Open
@maievsm

Description

@maievsm

Describe the bug
I'm using TypeORM, and there's a weird behavior when using an entity with a primary key not named "id". Adding a resource that has a relation to this entity will result in a success, but the resource wont be added at all.

Installed libraries and their versions
admin-bro: 3.4.0
admin-bro/express: 3.1.0
admin-bro/nestjs: 1.0.0
admin-bro/typeorm: 1.4.0
typeorm: 0.2.30

Schema

@Entity()
export class Profile extends BaseEntity {
  @PrimaryColumn()
  user_id: string;

  @OneToMany(() => Photo, (photo) => photo.profile)
  photos: Photo[];
}

@Entity()
export class Photo {
  @PrimaryGeneratedColumn()
  id: number;

  @ManyToOne(() => Profile, (profile) => profile.photos)
  profile: Profile;
}

When adding a Profile, everything works properly. But when adding a Photo, you'll receive a success despite it not being added.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions