Open Congelli501 opened 6 years ago
Please try latest DBAL master: MariaDB 10.3 support will only land in 2.9
On Fri, 12 Oct 2018, 14:36 Colin GILLE, notifications@github.com wrote:
I'm using the following versions of the doctrine packages:
doctrine/annotations v1.6.0 Docblock Annotations Parser doctrine/cache v1.8.0 Caching library offering an object-oriented API for many cache backends doctrine/collections v1.5.0 Collections Abstraction library doctrine/common v2.9.0 Common Library for Doctrine projects doctrine/dbal v2.8.0 Database Abstraction Layer doctrine/doctrine-bundle 1.9.1 Symfony DoctrineBundle doctrine/doctrine-cache-bundle 1.3.3 Symfony Bundle for Doctrine Cache doctrine/event-manager v1.0.0 Doctrine Event Manager component doctrine/inflector v1.3.0 Common String Manipulations with regard to casing and singular/plural rules. doctrine/instantiator 1.1.0 A small, lightweight utility to instantiate objects in PHP without invoking their constructors doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers. doctrine/orm v2.6.2 Object-Relational-Mapper for PHP doctrine/persistence v1.0.1 Doctrine Persistence abstractions. doctrine/reflection v1.0.0 Doctrine Reflection component
It seems I'm using the latest stable versions of the main packages.
Howether, I still experiment this bug: #2817 https://github.com/doctrine/dbal/issues/2817 When I use the latest mariadb version, doctrine always want to alter SQL columns to "default null".
Is the fix present in the latest stable version ? If not, is there any plan to backport it ?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/doctrine/dbal/issues/3321, or mute the thread https://github.com/notifications/unsubscribe-auth/AAJakHA_1maLesGZZSz2HoYH6cUvpHoeks5ukIzGgaJpZM4XZZAs .
Same Issue here using Mysql, but only if in dev-master, is working ok fixing version to 2.8.0.
This are some examples of the shema update output:
ALTER TABLE topic CHANGE visible visible TINYINT(1) DEFAULT '1' NOT NULL;
ALTER TABLE sylius_order_sequence CHANGE version version INT DEFAULT 1 NOT NULL;
+1
I installed the development branch of many doctrine packages (including dbal), and I'm still having the issue.
Here are the new versions:
doctrine/annotations v1.6.0 Docblock Annotations Parser
doctrine/cache dev-master 36c1147 PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.
doctrine/collections v1.5.0 Collections Abstraction library
doctrine/common v2.9.0 Common Library for Doctrine projects
doctrine/dbal dev-master master Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/doctrine-bundle dev-master 3ed47e7 Symfony DoctrineBundle
doctrine/doctrine-cache-bundle dev-master c6ea7a2 Symfony Bundle for Doctrine Cache
doctrine/event-manager dev-master 13dff35 The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector 1.3.x-dev 45d9b13 Common String Manipulations with regard to casing and singular/plural rules.
doctrine/instantiator 1.1.0 A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer v1.0.1 Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.
doctrine/orm 2.7.x-dev 01cff97 Object-Relational-Mapper for PHP
doctrine/persistence v1.0.1 Doctrine Persistence abstractions.
doctrine/reflection v1.0.0 Doctrine Reflection component
Is there anything else that needs upgrading ?
i have the same issue here with MariaDB 10.3
Db schema looks like
CREATE TABLE `NewTable` (
`id` int(11) NOT NULL AUTO_INCREMENT ,
`category_id` int(11) NULL DEFAULT ''
)
ENGINE=InnoDB
DEFAULT CHARACTER SET=utf8 COLLATE=utf8_unicode_ci
AUTO_INCREMENT=29668
ROW_FORMAT=DYNAMIC
;
But migrations still forces Default Null
ALTER TABLE NewTable CHANGE category_id category_id INT DEFAULT NULL
I had the same issue with mariadb 10.3 and dbal 2.9, but in my case, it was a doctrine config error.
The server_version
was incorrect in the config. This is the correct config:
doctrine:
dbal:
server_version: "mariadb-10.3.11"
ref: https://symfony.com/doc/current/reference/configuration/doctrine.html#doctrine-dbal-configuration
I also had some issue with boolean default values. I had to change from:
@ORM\Column(type="boolean", options={"default":false})
to:
@ORM\Column(type="boolean", options={"default":"0"})
I hope it helps.
@gyimgabor it works! thank you 👌👍🎁
@insekticid why does your DB schema have an empty string as the default value of an integer field? Could you provide your table definition and the way to reproduce the issue?
@morozov it is exported schema from MariaDB via Navicat gui. After @gyimgabor fix there is no issue
@gyimgabor suggestion works for @ORM\Column(type="string", length=255, nullable=true, options={"default": "NULL"})
as well, but it causes problems in case you use MariaDB on prod but MySQL locally for example, because it will generate VARCHAR(255) DEFAULT 'NULL'
instead of VARCHAR(255) DEFAULT NULL
for MySQL DB.
So, it's just a workaround for a bug that should be fixed in Doctrine
I'm using the following versions of the doctrine packages:
It seems I'm using the latest stable versions of the main packages.
Howether, I still experiment this bug: https://github.com/doctrine/dbal/issues/2817 When I use the latest mariadb version, doctrine always want to alter SQL columns to "default null".
Is the fix present in the latest stable version ? If not, is there any plan to backport it ?