Specifying a columnType in Property decorator doesn't produce desired schema
See original GitHub issueDescribe the bug
I’m trying to create an entity number property that maps to a Postgres numeric column with a specific precision and scale. However specifying the columnType
option in the @Property()
decorator doesn’t seem to result in anything but int4
.
To Reproduce Steps to reproduce the behavior:
- Create an entity with the following property
@Property({ type: 'number', columnType: 'numeric(10, 2)', default: 0 })
myAttribute: number = 0.00;
- Run
schemaGenerator.createSchema()
and inspect the dump
Expected behavior
The resulting sql builds a statement that includes the column definition as "my_attribute" numeric(10,2) not null default 0
Actual behavior
The resulting sql builds a statement that includes the column definition as "my_attribute" int4 not null default 0
Versions
Dependency | Version |
---|---|
node | 13.9.1 |
typescript | 3.8.3 |
mikro-orm | 3.5.1 |
pg | 7.18.2 |
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
TypeORM does not create tables, columns etc - Stack Overflow
Save this question. Show activity on this post. So it seems like TypeORM doesn't generate the tables / columns.
Read more >Entity Properties - EF Core | Microsoft Learn
How to configure and map entity properties using Entity Framework ... Included and excluded properties; Column names; Column data types ...
Read more >Custom Types - SQLAlchemy 1.4 Documentation
The TypeDecorator allows the creation of custom types which add bind-parameter and result-processing behavior to an existing type object. It is ...
Read more >Resolvers | NestJS - A progressive Node.js framework
Most of the definitions in a GraphQL schema are object types. ... that can exist in our data graph, but clients don't yet...
Read more >DataAnnotations - NotMapped Attribute in EF 6 & EF Core
The NotMapped attribute can be applied to properties of an entity class for which we do not want to create corresponding columns in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Will release this later today.
Can you try to add
rename(options, 'columnType', 'columnTypes');
toEntitySchema.addProperty
? Should be just about that.