breaking change on uuid column
See original GitHub issueIssue Description
update to 0.2.35, the uuid column force to char(36) #7853 , even if set type to varchar in options
Expected Behavior
if set type to varchar, it should be varchar
Actual Behavior
always char, no matter what type is set
export const IDColumnOpts = { type: 'varchar', charset: 'ascii', length: 36 } as const;
export abstract class BaseEntity extends TypeORMBaseEntity {
@Generated('uuid')
@PrimaryColumn({ comment: 'ID', ...IDColumnOpts })
id: string;
}
Steps to Reproduce
// insert code here
My Environment
Dependency | Version |
---|---|
Operating System | |
Node.js version | x.y.zzz |
Typescript version | x.y.zzz |
TypeORM version | x.y.zzz |
Additional Context
Relevant Database Driver(s)
DB Type | Reproducible |
---|---|
aurora-data-api |
no |
aurora-data-api-pg |
no |
better-sqlite3 |
no |
cockroachdb |
no |
cordova |
no |
expo |
no |
mongodb |
no |
mysql |
no |
nativescript |
no |
oracle |
no |
postgres |
no |
react-native |
no |
sap |
no |
sqlite |
no |
sqlite-abstract |
no |
sqljs |
no |
sqlserver |
no |
Are you willing to resolve this issue by submitting a Pull Request?
- ✖️ Yes, I have the time, and I know how to start.
- ✖️ Yes, I have the time, but I don’t know how to start. I would need guidance.
- ✖️ No, I don’t have the time, but I can support (using donations) development.
- ✖️ No, I don’t have the time and I’m okay to wait for the community / maintainers to resolve this issue.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:7
- Comments:8 (3 by maintainers)
Top Results From Across the Web
UUID field backed by String column in Postgres breaks `filter`
Describe the bug I'm using UUIDs for primary keys in my Fluent model representation, like this: @ID public var id: UUID?
Read more >What is a UUID, and why should you care? - Cockroach Labs
Here's how it breaks down visually: how a version 1 UUID breaks down. Generating UUIDs in this way makes having identical UUIDs almost ......
Read more >Recalculate UUIDs for Vulnerabilities::Findings using UUIDv5
The existing column is holding UUID V4 but the semantics are the same for V5 so we can utilize the same column and...
Read more >Unable to store UUIDs in H2 2.0.202 with Hibernate
Setting @Column(columnDefinition = "uuid") actually resolved an issue I was having with the embedded H2 Spring Boot Test DB not returning any ...
Read more >Should I call my UUID primary key column ID or not?
What if you have to change the data type of your foo_id column from integer to bigint ? You wouldn't want to change...
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 FreeTop 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
Top GitHub Comments
I’m having same issue, after syncing, our production database columns get cleared because of this. Thanks for new release !
Hi! My colleague @jsproede and I had the same problem and since we didn’t find any other solution, we wrote a migration. Maybe this helps one or the other.
The migration reads all your entities, finds their primary/foreign keys and modifies the column type. First we need to disable the foreign key checks, after everything has gone through we need to enable them again.
The good thing about this solution is that no data is lost!
Caution: Use at your own risk!
More: #8167 #7853 Docs: https://github.com/typeorm/typeorm/blob/master/docs/migrations.md