mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
MariaDB 10.2.7 BC break #5614
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @bilhackmac on GitHub (Jul 19, 2017).
Originally assigned to: @lcobucci on GitHub.
MariaDB 10.2.7 and future releases (5.5, 10.0 and 10.1 branches are not affected) just resolve an old bug in SQL standards implementation and introduce a BC break
Ticket that explains changes https://jira.mariadb.org/browse/MDEV-13132
Ticket that confirms (in comments) only >= v10.2.7 are affected https://jira.mariadb.org/browse/MDEV-13341
Concretely, for Doctrine, schema update just gone crazy and want to update every column with NULL default because 'NULL' is return by MariaDB instead of NULL.
I don't find any other issues… for now.
For the moment, MySQL don't have the same issue.
@Ocramius commented on GitHub (Jul 19, 2017):
Needs a test case though...
@sagaraspl commented on GitHub (Aug 24, 2017):
Hi @bilhackmac and @Ocramius I also faced the same issue when I updated with MariaDB 10.2.7
@belgattitude commented on GitHub (Aug 26, 2017):
Same issue too.
@baumannsven commented on GitHub (Aug 26, 2017):
I have the same problem.
@lcobucci commented on GitHub (Aug 26, 2017):
@sabzeta @belgattitude @baumannsven as @Ocramius said, please send us a PR with tests. That helps A LOT 😉
@sabzeta commented on GitHub (Aug 26, 2017):
I haven't realy ran into this problem, but it's good to be aware. I'll try to look into it.
Meanwhile, perhaps @sagaraspl could send a PR with tests?
@belgattitude commented on GitHub (Aug 26, 2017):
just published a P/R on https://github.com/doctrine/dbal/pull/2825 with the third approach... Feel free to comment.
@mdeboer commented on GitHub (Sep 6, 2017):
Same problem here, narrowed it down to it being a NULL problem of some sort as removing all nullable relations and fields solved it. That combined with me recently pulling the newest mariadb image for Docker explains it all.
There went another 3/4 hours of my day trying to find an error in my code even though the mapping files validated fine 😭 Using the mysql:5 image now which should fix things, fingers crossed 🤞 .
Hopefully a fix will be merged soon!
@lcobucci commented on GitHub (Nov 19, 2017):
https://github.com/doctrine/dbal/pull/2825 has just been merged and it will be released on DBAL
v2.7.0, please test if your issue is fixed when using"doctrine/dbal": "2.7.x-dev@dev"and let us know.@Bukashk0zzz commented on GitHub (Dec 3, 2017):
With "doctrine/dbal": "2.7.x-dev@dev" issue steel exist
@belgattitude commented on GitHub (Dec 3, 2017):
@Bukashk0zzz
Can you confirm, I don't have it anymore: My composer:
@Bukashk0zzz commented on GitHub (Dec 3, 2017):
Tested with mariadb 10.2.11 and 10.3.1 official docker image.
in composer
Always get diff with null on every field.
On percona 5.7 and standard mysql 5.7 all works correct.
@belgattitude commented on GitHub (Dec 3, 2017):
@Bukashk0zzz ,
Weird, in my case, testing on
10.2.11-MariaDB-10.2.11+maria~xenial-log mariadb.org binary distributionworks. As a simple reproducible test, I've just run a create update create/update based on openstore-schema-core project. (you can clone it if you like to test)Followed by an update:
So it's working fine.
I'm not aware of
symfony/orm-packbut I guess it's not the problem. Could you confirm the latest 2.7 master have been fetched.... You can easily see by doingIf there's a file named
MariaDb102Keywords.phpyou should have the latest one. Otherwise it might be a composer problem.Let me know. Thanks
@belgattitude commented on GitHub (Dec 3, 2017):
@Bukashk0zzz,
Have you recreated the database before testing ? It's possible you've already applied the migration with 'NULLs' prior to the patch (so your default values have been broken). Can be an possibility too
@Bukashk0zzz commented on GitHub (Dec 4, 2017):
Made clear demo example https://github.com/Bukashk0zzz/dbal-test
With code in repo above I every time get diff. You can check it by yourself
@Bukashk0zzz commented on GitHub (Dec 4, 2017):
I have one entity https://github.com/Bukashk0zzz/dbal-test/blob/master/src/Entity/Admin.php
And one init migration https://github.com/Bukashk0zzz/dbal-test/blob/master/src/Migrations/Version20171204100535.php
How I run project https://github.com/Bukashk0zzz/dbal-test/blob/master/up.sh
And after running I execute doctrine:migrations:diff or doctrine:schema:update
@belgattitude commented on GitHub (Dec 4, 2017):
@Bukashk0zzz
Can you check by commenting
server_version: '5.7'inconfig/packages/doctrine.yaml?Like this:
@belgattitude commented on GitHub (Dec 4, 2017):
With the commented server_version, everything looks good so far. Am I missing something ?
@Bukashk0zzz commented on GitHub (Dec 4, 2017):
Still has problem with commented server_version: '5.7'
At your screenshot you just run migrations. Try run now for getting diff:
@belgattitude commented on GitHub (Dec 4, 2017):
@Bukashk0zzz ...
Thanks, I can reproduce now... Could you help me to determine where the problem is ? I've just checked your entity, could you remove
unsignedif you're usingbooleans?And test with doctrine commands:
It looks working... Either you change the
statustointegeror if you're usingbooleanremove"unsigned"="true".Should be the same using
migrationscommands too.Could you confirm you don't have migrations using mysql-5.7 ? So I can look deeper
@belgattitude commented on GitHub (Dec 4, 2017):
Oups, just installed mysql-5.7... So with your entity, looks there's a diff generated as well:
So I guess the same behaviour is for MySQL 5.7 too. So the way to fix is to fix your entity. Is there anything I missed ?
@Bukashk0zzz commented on GitHub (Dec 4, 2017):
Updated repo. Now boolean not unsigned.
Still get diff:
ALTER TABLE admins CHANGE login login VARCHAR(255) DEFAULT NULL, CHANGE password password VARCHAR(255) DEFAULT NULL;
Also on percona and official mysql all works correct.
@belgattitude commented on GitHub (Dec 4, 2017):
@Bukashk0zzz
Looks you've forgot to remove 'server_version' ? I've made a p/r https://github.com/Bukashk0zzz/dbal-test/pull/1, have a look:
Could you test by doing (exactly) this:
What I have is
@belgattitude commented on GitHub (Dec 4, 2017):
Also note in your
symfony.lock:Not sure exactly how it can affect.... but it could be the problem. To be sure check:
If you're on the good doctrine version, you should have a
MariaDb102Keywords.phpfile in it.@Bukashk0zzz commented on GitHub (Dec 4, 2017):
Commenting 5.7 helped
Now all works correct. So there was two problems:
Add travis check for this case https://travis-ci.org/Bukashk0zzz/dbal-test/builds/311377116
@mdeboer commented on GitHub (Dec 4, 2017):
Glad it's fixed (by the looks of it), when will this make it to master?
@belgattitude commented on GitHub (Dec 4, 2017):
@Bukashk0zzz, happy for you. server_version will bypass database detection, that explains. For the other one:
unsigned bool in mapping, unsigned boolean (really tinyint(4)) does not play well with schema manager (same applies for Mysql 5.7, could you confirm ?).@mdeboer Don't know when they are able to release, but in the meantime, please be welcome to test ;)
@Bukashk0zzz commented on GitHub (Dec 5, 2017):
@belgattitude https://github.com/Bukashk0zzz/dbal-test/pull/2 as you can see mysql 5.7 have not any issue with unsigned bool. There are problems only with mariaDB
Check travis buid https://travis-ci.org/Bukashk0zzz/dbal-test/builds/311772602
You can create pull-request to this repo and test any cases you want.
@belgattitude commented on GitHub (Dec 5, 2017):
@Bukashk0zzz
Nope ! Your travis build show there's no migration, right ! But your entity does not have
unsigned:true. So it's meaningless... (see905ad233d5/src/Entity/Admin.php (L41))To figure out, please test with 'unsigned:true' AND mysql5-7 (both conditions, don't forget to remove existing migrations
rm -f src/Migrations/*.phpif needed).Anyway I just did the test on my laptop with mysql-5.7. And I can confirm, there's a migration happening with unsigned bool on mysql5.7 too.
Thanks
@Bukashk0zzz commented on GitHub (Dec 5, 2017):
@belgattitude You look at master not at PR and branch mysql
See PR files
https://github.com/Bukashk0zzz/dbal-test/pull/2/files
There are UNSIGNED in entity and in migration.
@belgattitude commented on GitHub (Dec 5, 2017):
Ok, I still don't get it. Cannot reproduce but we are using 2 different ways to tests. I cannot help with
doctrine:migrations... we need to start from dbal. Can you modify your travis scripts:b4dadcaa46/.travis.yml (L21)And only test with doctrine/dbal commands:
This is what I have both unsigned:true and mysql 5.7
I'm not using doctrine:migrations, that why I've always removed
rm -f src/Migrations/*.phpjust to be sure we work on the same schema specs. If the test above works for you, can you track it down to see where the migration process fails ?@belgattitude commented on GitHub (Dec 5, 2017):
For extended info, look what doctrine creates with
unsigned: boolson mysql-5.7 or mariadb-10.2:Here's the output (removed some columns for clarity):
It looks it didn't set the unsigned while creating...
But from schema introspection (schema:update) it always trigger a diff if using unsigned. DBAL seems to alias BOOL to TINYINT(1) and seems to remove unsigned property (mysql or mariadb). I don't think https://github.com/doctrine/dbal/pull/2825/ have changed that.
My question now is more about how 'doctrine:migrations' handles that. Can you eventually see if there's differences in generated migrations for both databases ? It can help me to track down the problem
Thanks
@Bukashk0zzz commented on GitHub (Dec 8, 2017):
@belgattitude You correct and on mysql and on mariadb with unsigned bool without my init migration always getting diff. Migrations generated by mysql and mariadb identical.
Answering on question how I get this migration:
I have already old project on ZF 1 and rewiring it to symfony 4 I just copy create table syntax from existing mysql db and set it to initial migration.
I agree with you that this not related to issue #2825
But what you think this are issue that dbal not correct handle unsigned bool ?
If yes I will create new issue. If no ok. Anyway I already fixed problem on my project.
travis test for mariadb https://travis-ci.org/Bukashk0zzz/dbal-test/builds/313452048
travis test for mysql https://travis-ci.org/Bukashk0zzz/dbal-test/builds/313450766
@mdeboer commented on GitHub (Dec 8, 2017):
Why on earth would you use an unsigned bool anyway? Unless it's part of a bigger issue I don't see why this has priority to get fixed.
@Bukashk0zzz commented on GitHub (Dec 9, 2017):
@mdeboer But why not? Near 6-7 years ago I always put unsigned for every integer that will be only with +
And that was good practice. Now I am using doctrine for a while and don't really look what created in db because all this things hided.
Anyway I agree that this not an issue for now. Thats why I asked and not created issue for that.
Also I think this issue can be closed @belgattitude tested everything.
@lcobucci commented on GitHub (Dec 17, 2017):
@Bukashk0zzz awesome, closing then!
@musicjerm commented on GitHub (Apr 6, 2018):
This issue has resurfaced for me with a clean symfony/website-skeleton install. Running MariaDB 10.2.14 and doctrine/dbal v2.7.0. I compared against a fresh symfony-standard-edition connected to the same database. Verified doctrine/* versions are the same. Set up a simple entity to map with one field nullable=true and I get the issue on the symfony 4.0 install but not the 3.4. Anyone else able to confirm my insanity?
@remoteclient commented on GitHub (Jun 11, 2018):
I opened a new [issue]https://github.com/doctrine/doctrine2/issues/7258 for MariaDB 10.2.14 as this issue reappears there.
@belgattitude commented on GitHub (Jun 11, 2018):
@remoteclient I'll reply on #7258 7258
@chrisg123 commented on GitHub (Feb 3, 2019):
Faced the same issue. Adding comment for searchability.
doctrine:schema:validatefailsSymfony Version 4.2.2
using:
Fix:
This solution worked for me. I suspect the problem had to do with a custom doctrine type I am using but cannot confirm. Only the entities that used this custom type were causing the issue, hence my suspicion.
First I tried updating doctrine/dbal. That did not work. I had to remove symfony/orm-pack then install doctrine to resolve.