Comments (3)
// Users.yml
entity: Users
parameters: {}
items:
users1:
name: 'admin'
from typeorm-fixtures.
tryed debug with ts file:
import * as path from 'path';
import { Builder, fixturesIterator, Loader, Parser, Resolver } from 'typeorm-fixtures-cli/dist';
import { createConnection, getRepository } from 'typeorm';
const loadFixtures = async (fixturesPath: string) => {
let connection;
try {
connection = await createConnection();
await connection.synchronize(true);
const loader = new Loader();
loader.load(path.resolve(fixturesPath));
const resolver = new Resolver();
const fixtures = resolver.resolve(loader.fixtureConfigs);
const builder = new Builder(connection, new Parser());
for (const fixture of fixturesIterator(fixtures)) {
const entity: any = await builder.build(fixture);
console.log(entity.constructor.name, fixture)
// console.log out:
// Users { parameters: {},
// processor: undefined,
// entity: 'Users',
// name: 'users1',
// data: { name: 'admin' },
// dependencies: [] }
await getRepository(fixture.entity).save(entity);
}
} catch (err) {
throw err;
} finally {
if (connection) {
await connection.close();
}
}
};
loadFixtures('./fixtures')
.then(() => {
console.log('Fixtures are successfully loaded.');
})
.catch(err => console.log(err));
from typeorm-fixtures.
It was the "nest-admin" entities, they rewrite my own entity.
/solved
from typeorm-fixtures.
Related Issues (20)
- [Feature request] Please hardcode faker package to 5.5.3 HOT 4
- Selectively apply Load Processor values to fixture items
- [Feature request] "Scenario": load fixtures from a single file and that can extend each other HOT 1
- [Bug] Lodash dependency pin
- [Bug] Postgres 'timestamptz' column failing at parsing long date HOT 4
- [Feature request] Add support for typeorm ^0.3.0 HOT 18
- [Bug] Update dependencies HOT 2
- [Bug] $current not working on array fields
- [Bug] class-validator entities may be incorrectly "unserialized/initialized" HOT 1
- [Bug] HOT 2
- [Bug] fix faker deprecation warning
- [Bug] Null ID when referencing another fixture HOT 1
- [Bug] glob is broken in Windows and cannot iterate by folder HOT 2
- [Feature request] Add support for regular expressions/glob patterns when setting fixtures location HOT 1
- [Bug]
- [Feature request] Add TsLoader for fixture
- Problem with @Exclude HOT 2
- [Feature request] Add faker examples with parameters in README
- [Feature request] Reference one field to generate another
- [Feature request] access to entity name in processor HOT 2
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-fixtures.