-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add a setting to opt-in for skipping type comments in the schema #6056
Comments
I think it's a good idea. It would still result in one massive migration, right? Anyway, what I like most about this is that it would expose potential issues we might have missed before we even release 4.0.0. |
No, it would result in no migration at all when migrating from the mutable types to the immutable types with this setting enabled as the database schema would be exactly the same (the only difference between those types will be the PHP conversion layer, which does not impact DB migrations). Of course, if you are already using immutable types today, enabling this setting will generate a migration to remove those comments. But that is the same migration than the one you would have when you migrate from 3.6 to 4.0 (as 4.0 removes those comments). The difference is that you could opt-in for this migration separately from the 4.0 upgrade. |
We wouldn't do this solely for immutable types though, would we? That's what I'm referring to with "massive migration": it would impact all columns with a DC2Type comment on it, right? Nothing negative about this BTW, I just want to make sure I'm understanding this fully.
That is a really great reason to go forward with what you are proposing. |
Indeed, if you use one of the other types that is currently marked as being commented, the comment would also be removed there. Here is the list of types that use it in the core:
|
Sure, go for it. 🙂 |
| Q | A |------------- | ----------- | Type | feature | Fixed issues | closes #6056 #### Summary This allows to opt-in for a schema generated without type comments once the project is migrating to the new schema tooling that does not need them, allowing to have a clean DB schema without waiting for DBAL 4.0 and to decouple the schema migration from the DBAL upgrade itself. I decided to name that field `disable*` so that the opt-in for the new behavior is done by setting it to `true`
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Feature Request
Summary
When using the platform-aware schema comparison, the type comments are useless (which is why they will be gone in 3.0).
For a project attempting to migrate from
DateTimeTzType
toDateTimeTzImmutableType
(or any of the other type pairs based onDateTime
vsDateTimeImmutable
) in order to migrate toDateTimeImmutable
, the schema tool would currently add type comments for all those date fields instead of not even having a database migration at all.It would be great to have a configuration setting to opt-in for the new behavior (not generating type comments) already to avoid those database migrations. When turned on,
\Doctrine\DBAL\Platforms\AbstractPlatform::getColumnComment
would always skip adding the type comment (without even callingcolumn->getType()->requiresSQLCommentHint($this)
).What do you think about that ?
The text was updated successfully, but these errors were encountered: