-
-
Notifications
You must be signed in to change notification settings - Fork 391
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
Change the column length of the version column to default to 14 #773
Conversation
@@ -43,7 +43,7 @@ class Configuration | |||
private $migrationsColumnName = 'version'; | |||
|
|||
/** @var int */ | |||
private $migrationsColumnLength = 255; | |||
private $migrationsColumnLength = 14; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private $migrationsColumnLength = 14; | |
private $migrationsColumnLength = 14; // strlen((new \DateTime())->format('YmdHis')) |
Or maybe initialize it with that call in the constructor?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is your reasoning for wanting to do it that way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Magic numbers are code smells I try to avoid by always showing what they represent, be it by using a constant, or showing what computation gave that result. For instance, I would use 60 * 60 * 24
* instead of 86400
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I made the change.
4a2e19c
to
67b875e
Compare
fixes #772
The version column by default is only 14 characters so we don't need to create a varchar(255) by default. This also causes issues with MariaDB see #514 and #538 and doctrine/DoctrineMigrationsBundle#247