Closed ishpagin closed 4 years ago
// Users.yml
entity: Users
parameters: {}
items:
users1:
name: 'admin'
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));
It was the "nest-admin" entities, they rewrite my own entity.
/solved
when I set data for Users entity I got extra fields in DB My Users entity:
I got:
With other entities all good, but not with this. What can it be?