Repository navigation
Closed as not planned
Closed as not planned
Copy link
Description
Issue description
The bigNumberStrings: false option triggers child entity's orphanedRowAction even when there are no changes
Expected Behavior
when save a with no change in bs, just update a. not any mutation query for b
UPDATE `a` SET `name` = ? WHERE `id` IN (?) -- PARAMETERS: ["test2",2]
Actual Behavior
typeORM delete bs by orphanedRowAction
Steps to reproduce
import "reflect-metadata";
import {
Column,
DataSource,
Entity,
ManyToOne,
OneToMany,
PrimaryGeneratedColumn,
} from "typeorm";
import * as express from "express";
@Entity()
class A {
@PrimaryGeneratedColumn()
id!: number;
@Column({ type: "varchar", length: 255 })
name!: string;
@OneToMany(() => B, (b) => b.a, { cascade: true, eager: true })
bs!: B[];
constructor(args?: { name: string }) {
if (args) {
this.name = args.name;
this.bs = Array.from({ length: 5 }, (_, i) => new B({ value: i }));
}
}
}
@Entity()
class B {
@PrimaryGeneratedColumn({ unsigned: true, type: "bigint" })
id!: number;
@Column({ type: "int" })
value!: number;
@ManyToOne(() => A, (a) => a.bs, { orphanedRowAction: "delete" })
a!: never;
constructor(args?: { value: number }) {
if (args) {
this.value = args.value;
}
}
}
async function initDB() {
const connection = new DataSource({
type: "mysql",
host: "localhost",
port: 3306,
username: "root",
password: "1234",
database: "test",
bigNumberStrings: false,
synchronize: true,
logging: true,
entities: [A, B],
});
await connection.initialize();
return connection;
}
(async () => {
const app = express();
const db = await initDB();
app.get("/save", async (_, res) => {
const a = new A({ name: "test" });
await db.manager.save(a);
res.send("pong");
});
app.get("/update", async (_, res) => {
const [a] = await db.manager.find(A, {
where: {
name: "test",
},
});
a.name = "test2";
await db.manager.save([a]);
res.send(a);
});
app.listen(3333, () => {
console.log("Server is running on port 3333");
});
})();My Environment
| Dependency | Version |
|---|---|
| Operating System | |
| Node.js version | 20.17.0 |
| Typescript version | 5.7.2 |
| TypeORM version | 0.3.20 |
Additional Context
No response
Relevant Database Driver(s)
- aurora-mysql
- aurora-postgres
- better-sqlite3
- cockroachdb
- cordova
- expo
- mongodb
- mysql
- nativescript
- oracle
- postgres
- react-native
- sap
- spanner
- sqlite
- sqlite-abstract
- sqljs
- sqlserver
Are you willing to resolve this issue by submitting a Pull Request?
Yes, I have the time, but I don't know how to start. I would need guidance.
Activity
[-]`bigNumberStrings: false` trigger `orphanedRowAction` with using cascade[/-][+]`bigNumberStrings` false option isn't work properly with relationship.[/+][-]`bigNumberStrings` false option isn't work properly with relationship.[/-][+]`bigNumberStrings: false` option isn't work properly with relationship.[/+]changchanghwang commentedon Feb 27, 2025
is there any update?
github-actions commentedon Sep 17, 2025
TypeORM has returned to active development after recently transitioning to new leadership (see related announcement).
As part of the new team's efforts to prioritise work on the project moving forward, it is necessary to clean up the backlog of stale issues.
🧹 This issue is being automatically closed because it has had no activity in the last 6 months.
If you believe this issue is still relevant, feel free to comment below and the maintainers may reopen it. Thank you for your contribution.