imjuni / erdia

CLI to generate mermaid.js ER diagram using TypeORM entity
https://imjuni.github.io/erdia/
MIT License
34 stars 0 forks source link

The type 'double precision' generates mermaid code with invalid syntax. #57

Closed takahashi-sdi closed 7 months ago

takahashi-sdi commented 8 months ago

Hello,

I have an entity that includes a double precision type.

@Entity()
export class SomeEntity {
  @PrimaryGeneratedColumn('uuid', { comment: 'ID' })
  readonly id!: string;

  @Column({ type: 'double precision', comment: 'Latitude' })
  lat!: number;

  @Column({ type: 'double precision', comment: 'Longitude'  })
  lon!: number;
}

Erdia generates mermaid source code as follows.

"some_entities(SomeEntity)" {
  uuid id    PK      "ID"  
  double precision lat      "Latitude"  
  double precision lon      "Longitude"  

This code syntax is invalid because mermaid does not support the double precision type.

imjuni commented 8 months ago

This looks like an issue with some formats supported by typeorm that are not mysql DB data types. For example, the same issue can occur with simple-json other than double precision. I'll see if I can find a way to fix it, or feel free to send me a PR with your own fix.

imjuni commented 7 months ago

@takahashi-sdi Fixed 3.4.1