Comments (10)
Hi @brunoti
Could you please provide me your entity ApplicationToken
for a full analysis.
Try to change the path to your entity. Maybe it can't find your entitiy.
from:
import { ApplicationToken } from '@backend/entities/ApplicationToken';
to static:
import { ApplicationToken } from '../entities/ApplicationToken';
from typeorm-seeding.
This also happened to me, fixed that by setting the TYPEORM_ENTITIES
environment variable.
from typeorm-seeding.
The error TypeError: this.subQuery is not a function
is because typeorm could not find any entities.
Please check your paths in your config file
from typeorm-seeding.
Hi @NMontilva
Sure the path to your entites is correct?
"entity/*.ts"
should this be "src/**/*.entity{.ts,.js}"
from typeorm-seeding.
Hello @hirsch88
Thank you! That was it.
from typeorm-seeding.
I'm using ormconfig.json and I'm getting the same error as @brunoti
I already set the entities variable in the .json and nothing. Same error
Here is my ormconfig.json
{ "type": "mysql", "host": "localhost", "port": 3306, "username": "a_username", "password": "a_password", "database": "a_db", "entities": ["entity/*.ts","dist/**/*.entity{.ts,.js}"], "synchronize": true, "seeds": ["src/database/seeds/**/*.seed.ts"] }
UPDATE:
I downgraded typeorm to 0.2.22 and it's working again.
from typeorm-seeding.
I had the same issue
from typeorm-seeding.
Relatable, exactly the same error here!
#53 (comment) Downgrading typeorm to 0.2.22 doesn't work either
There are how my files look like:
maratona.entity.ts
import { Entity, Column, CreateDateColumn, PrimaryGeneratedColumn } from 'typeorm';
@Entity({ name: 'maratonas' })
export class Maratona {
@PrimaryGeneratedColumn('uuid')
id: string;
@Column()
title: string;
@Column()
date: Date;
@CreateDateColumn()
created_at?: Date;
}
maratona.seed.ts
import { Connection } from 'typeorm';
import { Factory, Seeder } from 'typeorm-seeding';
import { Maratona } from '../entities/maratona.entity';
export default class CreateUsers implements Seeder {
public async run(factory: Factory, connection: Connection): Promise<any> {
return await connection
.createQueryBuilder()
.insert()
.into(Maratona)
.values([
{ title: 'Full Cycle: Arquitetura e Estudo de Caso', date: `${new Date('04/05/2020')}` }
])
.execute();
}
}
.env
TYPEORM_CONNECTION=sqlite
TYPEORM_DATABASE=database.sqlite
TYPEORM_ENTITIES=src/**/*.entity{.ts,.js}
TYPEORM_MIGRATIONS=src/database/migrations/**/*.ts
TYPEORM_MIGRATIONS_DIR=src/database/migrations
TYPEORM_SEEDING_FACTORIES=src/database/factories/**/*{.ts,.js}
TYPEORM_SEEDING_SEEDS=src/database/seeds/**/*{.ts,.js}
from typeorm-seeding.
In addition to the path in ormconfig, check if your entities were imported in your module.
from typeorm-seeding.
For posterity: If you're using e.g. entities/index.ts to list your entities, make sure it is being exported there.
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.