-
-
Notifications
You must be signed in to change notification settings - Fork 495
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
defaultRaw current_timestamp(3) not taken into account in generated migration #4782
Comments
Looks like an issue with |
Digging in the source code, I think I found the root cause in https://github.com/mikro-orm/mikro-orm/blob/master/packages/knex/src/schema/SchemaHelper.ts#L251. Changing my example above with the following seems to work:
|
Hmm interesting, I'd say the problem is that we shouldn't touch the user-provided |
Right, the main issue here is the inference of the length for datetime columns were not implemented, we just used the platform default. That's why providing https://github.com/mikro-orm/mikro-orm/blob/master/packages/knex/src/schema/DatabaseTable.ts#L85 |
@B4nan thanks for fixing this so quickly 👍 |
Describe the bug
When specifying
defaultRaw: 'CURRENT_TIMESTAMP(3)'
on a Date property on an entity, the generated migration will containdefault current_timestamp(0)
To Reproduce
Steps to reproduce the behavior:
mysql
type in mikro-orm.config.tsnpx mikro-orm migration:create
Expected behavior
I would expect the migration to contain
default current_timestamp(3)
as specified in the entitydefaultRaw
.Versions
The text was updated successfully, but these errors were encountered: