typeorm: [Bug] UpdateById broken due to wrong operation?
So here’s the entity code:
@Entity('MON_CONTROL_PLACE', {
orderBy: {
name: 'ASC',
id: 'DESC',
},
} as any)
export class ControlPlace {
@PrimaryGeneratedColumn({
// name: 'MON_CONTROL_PLACE_ID',
})
id: number
@Column({
nullable: false,
unique: true,
})
name: string
// Relations
@OneToMany(
(type) => RouteLine,
(routeLine) => routeLine.controlPlace,
)
routeLines: Promise<RouteLine[]>
@CreateDateColumn()
createdAt: Date
@UpdateDateColumn()
updatedAt: Date
@VersionColumn()
version: number
}
Here’s the relation code:
@Entity('MON_ROUTE_LINE', {
orderBy: {
id: 'DESC',
},
} as any)
export class RouteLine {
@PrimaryGeneratedColumn({
name: 'MON_ROUTE_LINE_ID',
})
id: number
@Column('real', {
default: 0,
})
kms: number
@Column('time without time zone', {
nullable: false,
})
horas: Date
// Relations
@ManyToOne(
(type) => Route,
(route) => route.routeLines,
{ nullable: false },
)
@JoinColumn({
// name: 'MON_ROUTE_ID',
})
route: Promise<Route>
@ManyToOne(
(type) => ControlPlace,
(controlPlace) => controlPlace.routeLines,
{ nullable: false },
)
@JoinColumn({
// name: 'MON_CONTROL_PLACE_ID',
})
controlPlace: Promise<ControlPlace>
@CreateDateColumn()
createdAt: Date
@UpdateDateColumn()
updatedAt: Date
@VersionColumn()
version: number
}
And here’s the error:
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17 (15 by maintainers)
Commits related to this issue
- fixes issues with update, insert, delete query builder; added support of embeds in there, plus in find options. Fixes #931 #971 #999 #942 — committed to typeorm/typeorm by deleted user 7 years ago
- Next (#3) * added cli options to init command generated project * renamed TableSchema in to Table * renamed ColumnSchema in to TableColumn; renamed ForeignKeySchema in to TableForeignKey; ren... — committed to f-wrobel/typeorm by f-wrobel 7 years ago
For some reason it says that certain relation cannot be null, which in theory should already have a value in database since is an update, seems like if i don’t extract the
id
out ofdata
then it doesn’t take it as a partial.