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

[aurora-data-api] Using unsigned int columns causes FK drop / recreation #9477

Closed
mkilp opened this issue Oct 19, 2022 · 0 comments · Fixed by #9478
Closed

[aurora-data-api] Using unsigned int columns causes FK drop / recreation #9477

mkilp opened this issue Oct 19, 2022 · 0 comments · Fixed by #9478

Comments

@mkilp
Copy link
Contributor

mkilp commented Oct 19, 2022

Issue Description

Default width of unsigned columns of unsigned columns does not match metadata in MariaDB and MySQL 5.7. This also applies to Aurora MySQL. A fix has been implemented in #6632 for MySQL but never replicated into aurora-data-api.

Opening this issue for tracking and testing. PR follows.

Expected Behavior

Metadata of an INT UNSIGNED column is detected with a width of 10. Migrations should not detect this as a changed column.

Actual Behavior

Metadata of an INT UNSIGNED column is detected with a width of 11. This causes migrations / synchronize to recreate the column over and over again. All foreign keys pointing to these columns are recreated.

Steps to Reproduce

Create an entity with

@PrimaryGeneratedColumn({ unsigned: true })
      id: number;

and have synchronize on. The column will be changed every time.

My Environment

Dependency Version
Operating System Windows 10
Node.js version 16.14.2
Typescript version 4.6.2
TypeORM version 0.3.10

Additional Context

Fix is found, PR follows.

Relevant Database Driver(s)

DB Type Reproducible
aurora-mysql yes
aurora-postgres 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
spanner 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.
mkilp added a commit to mkilp/typeorm that referenced this issue Oct 19, 2022
AlexMesser pushed a commit that referenced this issue Nov 4, 2022
…-data-api (#9478)

* fix: resolve issue with migrations and unsigned int columns in aurora-data-api

Closes: #9477

* refactor: fix prettier

* refactor: fix prettier again
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant