w3tecch / typeorm-seeding

🌱 A delightful way to seed test data into your database.
https://www.npmjs.com/package/typeorm-seeding
MIT License
877 stars 131 forks source link

this.subQuery is not a function #227

Open mirzasetiyono opened 2 years ago

mirzasetiyono commented 2 years ago

i try to a insert a simple row using createQueryBuilder

await connection.createQueryBuilder() .insert() .into(User) .values( [ { wallet_account_public_key: "stringstring", name: "stringstring", joined_date: newEpoch(), roles: [] } ] ) .execute();

this query only doesnt work in the seed class impemention Seeder inside the run function

but when i do this query, its work

await connection.createQueryBuilder() .insert() .into(Role) .values( [ { name: "normal" }, { name: "admin" }, { name: "superadmin" } ] ).execute();

idk why but its very very very weird

laolee010126 commented 1 year ago

I guess deprecated Connection makes this error

using with factory it does not make any error, but with connection make this error

ex) connection .createQueryBuilder() .insert() .into(Topic) .values(topics) .execute();

but const topics = await factory(Topic)().createMany(10);

this one dose not make any error for me