-
-
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
Document the serverVersion
option in a forward-compatible manner
#5971
Conversation
docs/en/reference/configuration.rst
Outdated
e.g. ``8.0.32`` instead of just ``8`` if your server is a MySQL 8.0.32. This | ||
means that if you are running a MariaDB database, you should suffix the | ||
``serverVersion`` with ``-MariaDB`` (ex: ``10.11.2-MariaDB``). |
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.
I'd remove the "you should suffix" part as it's controversial. The user should specify the server version verbatim, without adding or removing anything. The documentation could suggest running the following code snippet and using its output as the value of serverVersion
:
echo $connection->getServerVersion(), PHP_EOL;
Specific versions of MariaDB could be used as an example. In my case, it produces:
10.11.2-MariaDB-1:10.11.2+maria~ubu2204
Note that this method is private
in DBAL 3, so the snippet needs to be adapted.
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.
Since we're talking about MySQL/MariaDB specifically, we could refer to whatever this query returns:
SELECT VERSION();
WDYT?
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.
Since we're talking about MySQL/MariaDB specifically [...]
Are we? This documentation applies to all platforms for which the DBAL has different implementations for different versions.
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.
Are we? This documentation applies to all platforms for which the DBAL has different implementations for different versions.
True, but the fact that we're parsing the suffix of a version string is very much specific to MariaDB.
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.
Which is an implementation detail of our version detection logic. Why should users be aware of that?
The whole extent of this feature is providing the server version in the configuration in order to prevent the application from connecting to the database during the calls to Connection::getServerVersion()
. The more implementation details we expose via the documentation, the more chances are that the documentation will become obsolete at some point or will have to be continuously changed alongside the changes in supported platforms.
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.
A private getServerVersion()
is also an implementation details in form of a choice to outsource some logic into a private method. Private methods can be removed and shouldn't appear in the docs. Maybe it should be added to the branch for version 4 though.
I'm not sure if we currently have a generic way to get the server version string for the config,
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.
It's a good point. It is private because it's only used for platform detection and is not supposed to be used outside of DBAL. But the thing is that we want to call it in order to use by the DBAL internally.
Anyways, I think this issue doesn't deserve that much discussion. I'm fine with whatever you all decide.
We need to tell people to use a verbatim version string, but all DBAL APIs that would deliver that string are internal. I've updated my PR with detailed instructions for MySQL, MariaDB and Postgres on how to get the version string without DBAL. For other platforms, the version string is currently irrelevant, but I've documented the use of the internal APIs for that matter, although I'm not very comfortable with such APIs appearing in the documentation. btw, I've tried to reply in the thread, but GitHub threw HTTP 500 responses at me when I tried to do so. 😓 |
All right, pushing to my branch doesn't work either at the moment. I guess, we need to wait until GitHub got rid of its little hiccup. 😑 |
e6b150e
to
5789567
Compare
bce92fc
to
e496e93
Compare
* Add mariadb example to DATABASE_URL * Apply change requests * Use same casing as in the doctrine/dbal mariadb docs See doctrine/dbal#5971 * Update doctrine/doctrine-bundle/2.8/manifest.json Co-authored-by: Alexander M. Turek <me@derrabus.de> * Use only major version for postgresql serverVersion --------- Co-authored-by: Alexander M. Turek <me@derrabus.de>
Summary
The examples that we give for the
serverVersion
option are all invalid as per #5779, which means they will not work in DBAL 4. This PR changes the affected section of the documentation.