Skip to content

cli/generate-entities doesn't emit collection name #1328

@jasonwilson

Description

@jasonwilson

Describe the bug
When using the generate-entities the emitted classes don't include the collection name on the entity.

Stack trace

(node:3691) UnhandledPromiseRejectionWarning: TableNotFoundException: select count(distinct("e0"."id")) as "count" from "f20181234" as "e0" - relation "f20181234" does not exist

To Reproduce
Steps to reproduce the behavior:

sql

CREATE TABLE f2018_1234(
    id INT NOT NULL,
    PRIMARY KEY (id)
)

command

npx mikro-orm generate-entities --dump

got

@Entity()
export class F20181234 {

  @PrimaryKey()
  id!: number;

}

expected

@Entity({collection: 'f2018_1234'})
export class F20181234 {

  @PrimaryKey()
  id!: number;

}

Expected behavior
Ideally the generated classes would map back to the tables in the source database.

Additional context
Not sure if I'm missing something with args or this is expected behavior

Versions

Dependency Version
node 14.5.1
typescript 4.1.3
mikro-orm 4.3.4
your-driver postgres

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions