Comments (3)
This isnt an issue with typeorm-seeding
, this is how typeorm
works under the hood, check out the official documentation
There are requirements for each entity listener to run correctly, in this case, for BeforeInsert
to run you must use repository/manager save (or create, whichever you prefer, and the others also have their second option like save-create). So your code would look like this:
await connection
.createQueryBuilder()
.insert()
.into(User)
.values([
// Triggers BeforeInsert
await connection.manager.create(User, {
name: 'Admin',
email: '[email protected]',
company: 'Admin Ltd.',
password: 'test123'
})
])
.execute()
But you should really be using the factorys make
and seed
methods to create the entites. In case you use make
, use connection.manager.save
to save the entities, which goes through the entity listeners correctly.
from typeorm-seeding.
I have the same issue. Please, what's the fix?
from typeorm-seeding.
🎉 This issue has been resolved in version 1.4.1 🎉
The release is available on:
Your semantic-release bot 📦🚀
from typeorm-seeding.
Related Issues (20)
- update major faker version please HOT 1
- Faker npm package not supported HOT 1
- Faker got abandoned and NPM audit complains about it HOT 1
- TypeError: Cannot read properties of undefined(reading 'number') HOT 3
- Support [email protected] HOT 2
- how to truncate tables? HOT 1
- There is a typo for the shebang in the dist/cli.js HOT 1
- Example for how to seed ManyToMany relation HOT 1
- [Request] Support for typeorm 0.3 and nestjs/typeorm v8.1.0 HOT 1
- Database connection failed! Check your typeORM config file. MissingDriverError: Wrong driver: "undefined" given. HOT 4
- this.subQuery is not a function HOT 1
- [Request] Support for typeorm 0.3 and nestjs/typeorm v8.1.0 HOT 20
- Replace `faker` with `@faker-js/faker` HOT 2
- Hello. I just have a question HOT 1
- TypeError: Cannot read properties of undefined (reading 'name')
- prevent seed:config to log any output
- How to seed data with monorepo workspace in nestjs HOT 4
- unable to resolve dependency tree HOT 8
- Publish 1.6.2 HOT 2
- Doesn't finish command
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typeorm-seeding.