This may be a bug, but being a new user of Skipper, I'm hoping it's user error, so I am posting this to "How To".
I am using Skipper 3.2.14.1430, Doctrine DBAL v2.8.0, and MySQL v14.14.
Using YML ORM files, I have gotten my database to be completely in sync with Skipper. However, because of the issue with Gedmo Timestampable, I have to manually remove the dashes in order for this to work. After reading this forum, I decided to try XML ORM files as I learned that YML will soon be deprecated in Doctrine.
When I simply changed the Skipper setting to output as XML, Doctrine now reports numerous SQL updates. I found this to be disturbing, but let me continue.
An issue I found is with the default value of a nullable string field. In Skipper, under the General Properties of the field, if "not-null" is set to false (in other words, nullable is true), and default is set to NULL, the resulting XML in the ORM file will be:
<field name="label" type="string" length="50" nullable="true">
<options>
<option name="default">NULL</option>
</options>
</field>
When I run the doctrine command:
bin/console doctrine:schema:update --dump-sql
The resulting SQL will shows:
ALTER TABLE network CHANGE label label VARCHAR(50) DEFAULT 'NULL';
Notice, NULL is wrapped in quotes.
If I try leaving the default option blank in Skipper the resulting XML is:
<field name="label" type="string" length="50" nullable="true">
<options>
<option name="default"/>
</options>
</field>
So now when I run the doctrine command, the resulting SQL is:
ALTER TABLE network CHANGE label label VARCHAR(50) DEFAULT '';
Notice it will not set the field with a default empty string.
The only way I have found to get the result I am wanting, is to manually remove the options block from the ORM file.
<field name="label" type="string" length="50" nullable="true">
</field>
Now the resulting SQL is:
ALTER TABLE network CHANGE label label VARCHAR(50) DEFAULT NULL;
Notice, NULL is no longer wrapped in quotes, but is a literal NULL value. This is what I want.
Is there any way to have Skipper create the correct XML ORM file for me?