Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Schema log regenerates enum every time (even if no changes) #3587

Closed
onionhammer opened this issue Feb 6, 2019 · 0 comments
Closed

Schema log regenerates enum every time (even if no changes) #3587

onionhammer opened this issue Feb 6, 2019 · 0 comments

Comments

@onionhammer
Copy link

onionhammer commented Feb 6, 2019

Issue type:

[ ] question
[x] bug report
[ ] feature request
[ ] documentation issue

Database system/driver:

[ ] cordova
[ ] mongodb
[ ] mssql
[ ] mysql / mariadb
[ ] oracle
[x] postgres
[ ] 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:

I've created several enum columns, every time I create a migration or run schema:log typeorm calls CREATE TYPE for them, even if there have been no changes.

@Entity("equipmentmodels")
@Unique(["name"])
export class EquipmentModel {
  /* snipped other properties for simplicity */
  
  @PrimaryGeneratedColumn("uuid")
  id: string

  /** Type of equipment */
  @Column("enum", { enum: EquipmentModelType })
  type: EquipmentModelType

}
export enum EquipmentModelType {
  Thing1,
  Thing2,
  Thing3,
  Thing4
}

Consistently yields this

DROP TYPE "pcc"."devicemodels_type_enum_old";
ALTER TYPE "pcc"."equipmentmodels_type_enum" RENAME TO "equipmentmodels_type_enum_old";
CREATE TYPE "pcc"."equipmentmodels_type_enum" AS ENUM('0', '1', '2', '3');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants