Skip to content

Enum type generated in wrong schema. #6772

@mwienk

Description

@mwienk

Issue type:

[X] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[X] postgres
[ ] cockroachdb
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo

TypeORM version:

[X] latest
[ ] @next
[ ] 0.x.x (or put your version here)

Steps to reproduce or a small repository showing the problem:

Using an enum value

enum UsageType {
  FRAMES = 'frames',
  REPORT_GAIT = 'reports.gait',
  REPORT_RULA = 'reports.rula',
  REPORT_ACL = 'reports.acl',
}

@Column({
    type: 'enum',
    enum: UsageType,
    enumName: 'billing_usage_type_enum',
    default: UsageType.REPORT_GAIT,
  })
  usage_type: UsageType;

In combination with a defined postgres schema results in the enum type being created in the default schema (using the typeorm migrations generator).

await queryRunner.query(`CREATE TYPE "billing_usage_type_enum" AS ENUM('frames', 'reports.gait', 'reports.rula', 'reports.acl')`);

Instead of

await queryRunner.query(`CREATE TYPE "app_schema"."billing_usage_type_enum" AS ENUM('frames', 'reports.gait', 'reports.rula', 'reports.acl')`);

The referring columns also point to the default schema.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions