I have the following entity:
@Entity(‘team_player’)
export class TeamPlayer {
@PrimaryColumn({ type: ‘uuid’, primary: false })
@ApiProperty({ type: ‘string’, format: ‘uuid’ })
player_id: string;
@ApiProperty({ type: ‘string’, format: ‘uuid’ })
@Column({ type: ‘text’ })
team_id: string;
}
And am running the following test:
beforeEach(async () => {
// Set up 3 players for one team
await TeamPlayer.save({
player_id: player1Id,
team_id: teamId,
});
await TeamPlayer.save({
player_id: player2Id,
team_id: teamId,
});
await TeamPlayer.save({
player_id: player3Id, // only row that gets saved in final result
team_id: teamId,
});
});
When I look at my DB, only the last player gets saved, assuming it’s replacing the previous ones that got saved. I don’t want that behaviour but rather to have all 3 rows.
team_id player_id
---------------------------
5555555 player3Id
Is that something that can be fixed by simply changing the entity?