change field name relation typeorm 1

change field name relation typeorm

@Table()
export class Post {
    @PrimaryGeneratedColumn()
    id: number;

    @OneToOne(type => Members, member=>member.post)
    @JoinColumn({ name: "member_id" })
    member: Members;

   // this is optional:
   // @Column({  type: "int", nullable: true })
   // memberId: number;

    @Column()
    comment:string;
}

Here is what the above code is Doing:
1. We are creating a new entity called Post.
2. We are creating a new column called id which is the primary key and auto-incrementing.
3. We are creating a new column called memberId which is a foreign key to the Members table.
4. We are creating a new column called comment which is a string.
5. We are creating a new relationship between the Post and Members table.
6. We are creating a new relationship between the Post and Members table.
7. We are creating a new relationship between the Post and Members table.

Similar Posts