-
-
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
Feature: Add Real/Float4 type #6467
Conversation
MySQL, as always, has its own naming conventions; for them, UPD: Because MySQL does things differently from others, the type name If you are satisfied with the PR, it might be appropriate to rename P.S |
Oracle DBMS also supports this type in its own way :). According to the documentation, the FLOAT type differs only in precision. Checked DBMS:
|
Thank you. Please mind PHPCS. We currently develop new features on the 4.1 branch. Can you elaborate why you this this change should be merged to 3.9 instead? |
Oh, because of the existence of the 3.9 branch, I just couldn't decide where to send this new feature first. |
Unless you can make a very strong case for why we should add this feature to DBAL 3, I'd prefer shipping your feature with DBAL 4 only. No need to recreate the PR, a simple rebase should be enough. |
Hmm... it was a mistake to make changes in the main branch. :) I tried to isolate my changes in a separate branch and then rebase them onto 4.1, but I'm having issues resolving merge conflicts. The git program doesn't want to accept them, and it's becoming messy. I think it's better if I recreate this PR, if you don't mind. |
You can build a new branch, reset this branch to the new one and force push. No need for a new PR |
Sure, whatever works for you. |
@greg0ire |
<!-- Fill in the relevant information below to help triage your pull request. --> | Q | A |------------- | ----------- | Type | feature #### Summary Recreated PR #6467 for branch 4.1. This PR adds support for the `REAL` type for all DBMS, thereby resolving issues with partial support and potential bugs related to the `REAL` type in SQL schemas during migration creation. I've tried to explain this issue in detail through the `INET` type here #6466. Checked DBMS: - [x] PostgreSQL (represents `REAL` as `float4` or `real`) - [x] MySQL/MariaDB (#6467 (comment)) - [x] MSSQL (represents `REAL` as `real`) - [x] Oracle (represents `REAL` as `float(63)`) [doc ](https://docs.oracle.com/en/database/oracle/oracle-database/12.2/sqlqr/Data-Types.html) - [x] IBM DB2 (represents `REAL` as `real`) - [x] SQLite (represents `REAL` as `real`)
Summary
Hello,
As I described in this issue #6466 (comment), there is a strange behavior with types in Doctrine, especially after migrating from
DC2Type
.One of the problems is that when type comments like
DC2Type
were used, many checks were seemingly ignored, which allowed the use of theREAL
(float4) type. In fact, this is still possible now because there are scattered checks forREAL
but they are not fully implemented.For example, Doctrine won't notice a problem in this case:
However, it will try to revert it to
DOUBLE PRECISION
if we specifyDEFAULT
, but even here there is a nuance. If we specify it like this, Doctrine will accept theREAL
type. (float in quotas in the entity and without them in the migration)Therefore, in this PR, I want to add support for the
REAL
type, which is supported by most DBMSs, which will fix that weird behavior for float types, and this will also allow people to transition fromDC2Type
comments without the need to reassign types inmapping_types
. It also seems odd to me that Doctrine supportsSMALLINT
,INT
,BIGINT
, but only supportsfloat8
and notfloat4
.Thanks.