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
MySql signed primary key migration #5485
Comments
Just FYI this definition does not make much sense, you use @PrimaryKey({ autoincrement: false, unsigned: false })`
id!: bigint; (it won't fix the problem you are reporting, but at least you won't be lying to yourself - the ORM would hydrate |
Yes I believe I originally did that since I do want a JS number, but MySQL int does not support same max/min value as JS number so I was getting errors saving some values to the database. |
My point is that |
Describe the bug
I have an entity that has a signed primary key like so:
I am trying to use in another class as a
ManyToOne
reference, but in the generated migrations, the generated foreign keyuser_id
is of typeunsigned
so running the migration fails with errorReferencing column 'user_id' and referenced column 'id' in foreign key constraint 'message_user_id_foreign' are incompatible
(or similar error, in repro the error is a missing index). Am I missing something that can get this working?Reproduction
https://github.com/HermanFassett/mikro-orm-repro/
What driver are you using?
@mikro-orm/mysql
MikroORM version
6.2.2
Node.js version
20.12.0
Operating system
Windows 10
Validations
The text was updated successfully, but these errors were encountered: