<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Thu Jun 20 12:05:46 UTC 2013

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary add field=key&field=summary to the URL of your request.
For example:
http://www.doctrine-project.org/jira/si/jira.issueviews:issue-xml/DC-708/DC-708.xml?field=key&field=summary
-->
<rss version="0.92" >
<channel>
    <title>Doctrine Project</title>
    <link>http://www.doctrine-project.org/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>5.2.7</version>
        <build-number>850</build-number>
        <build-date>21-02-2013</build-date>
    </build-info>

<item>
            <title>[DC-708] Wrong definition for MySQL string primary column</title>
                <link>http://www.doctrine-project.org/jira/browse/DC-708</link>
                <project id="10031" key="DC">Doctrine 1</project>
                        <description>&lt;p&gt;If you define a primary column, the attribute &lt;b&gt;notnull&lt;/b&gt; is removed from the column definition because Doctrine assumes that primary columns are always not null.&lt;/p&gt;

&lt;p&gt;Now suppose you have a schema like this, with a &lt;b&gt;string&lt;/b&gt; primary column.&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;Client:
  columns:
    serial:    { type: string(50), notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt;, primary: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
    name:      { type: string(36), notnull: &lt;span class=&quot;code-keyword&quot;&gt;true&lt;/span&gt; }
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;That&apos;s fine, but causes problems with MySQL where the column is created with a default value of &quot;&quot; (empty string) and not &amp;lt;none&amp;gt;.&lt;/p&gt;

&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;CREATE TABLE client (serial VARCHAR(50), name VARCHAR(36) NOT NULL, PRIMARY KEY(serial)) ENGINE = INNODB;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;
&lt;p&gt;Note that the 2nd column is well defined and has &amp;lt;none&amp;gt; as default value (as seen from phpMyAdmin).&lt;/p&gt;

&lt;p&gt;I attached a quick-workaround to disable the code which removes the &lt;b&gt;notnull&lt;/b&gt; attribute from column definition.&lt;/p&gt;

&lt;p&gt;After that the SQL code is like this:&lt;/p&gt;
&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;CREATE TABLE client (serial VARCHAR(50) NOT NULL, name VARCHAR(36) NOT NULL, PRIMARY KEY(serial)) ENGINE = INNODB;
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</description>
                <environment>PHP 5.3.1, WinXP-SP3, Doctrine 1.2.2, MySQL 5.1.41</environment>
            <key id="11422">DC-708</key>
            <summary>Wrong definition for MySQL string primary column</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="3" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/major.png">Major</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                                <assignee username="jwage">Jonathan H. Wage</assignee>
                                <reporter username="nicorac">Claudio Nicora</reporter>
                        <labels>
                    </labels>
                <created>Fri, 28 May 2010 08:41:16 +0000</created>
                <updated>Mon, 12 Jul 2010 16:32:44 +0000</updated>
                                    <version>1.2.2</version>
                                <fixVersion>1.2.2</fixVersion>
                                <component>Import/Export</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>1</watches>
                        <comments>
                    <comment id="13078" author="nicorac" created="Fri, 28 May 2010 09:08:46 +0000"  >&lt;p&gt;Attached a better patch where the &lt;b&gt;notnull&lt;/b&gt; attribute is removed only if the primary column type is &lt;b&gt;string&lt;/b&gt;&lt;/p&gt;</comment>
                    <comment id="13079" author="nicorac" created="Fri, 28 May 2010 09:25:01 +0000"  >&lt;p&gt;The same behaviour happens even for integer columns, so the &lt;b&gt;notnull&lt;/b&gt; attribute should never be removed, not only for string columns. New patch attached, old one removed.&lt;/p&gt;</comment>
                    <comment id="13145" author="jwage" created="Tue, 8 Jun 2010 09:58:05 +0000"  >&lt;p&gt;The patch I see currently just comments out the offending code. Is that intended? It cannot be committed if so &lt;img class=&quot;emoticon&quot; src=&quot;http://www.doctrine-project.org/jira/images/icons/emoticons/smile.gif&quot; height=&quot;20&quot; width=&quot;20&quot; align=&quot;absmiddle&quot; alt=&quot;&quot; border=&quot;0&quot;/&gt;&lt;/p&gt;</comment>
                    <comment id="13155" author="nicorac" created="Tue, 8 Jun 2010 10:33:26 +0000"  >&lt;p&gt;My patch only removed the effect, but it&apos;s not surely the best solution.&lt;/p&gt;

&lt;p&gt;I&apos;ve no sufficient knowledge on Doctrine to say that commenting out (or removing) that line will not affect other parts; that&apos;s why I only commented out the code instead of removing it (both on my side and on the attached patch).&lt;/p&gt;

&lt;p&gt;If you think I&apos;m not adding new bugs, I agree that removing the offending code is the cleanest way.&lt;/p&gt;</comment>
                    <comment id="13156" author="jwage" created="Tue, 8 Jun 2010 10:36:00 +0000"  >&lt;p&gt;We can&apos;t just remove the code. It will change the behavior of the builder drastically which breaks backwards compatibility.&lt;/p&gt;</comment>
                    <comment id="13168" author="nicorac" created="Tue, 8 Jun 2010 11:46:12 +0000"  >&lt;p&gt;That&apos;s what I was afraid of.&lt;br/&gt;
Maybe you should change the code that generates the SQL for MySQL to make it include the &quot;NOT NULL&quot; clause to primary keys.&lt;/p&gt;</comment>
                    <comment id="13169" author="jwage" created="Tue, 8 Jun 2010 11:48:02 +0000"  >&lt;p&gt;Hi, if you want to provide a patch that fixes your situation I can test it against our test suite and see if we can include it. You can also run your changes against the test suite to see if it causes any problems.&lt;/p&gt;</comment>
                    <comment id="13285" author="nicorac" created="Sun, 13 Jun 2010 05:39:19 +0000"  >&lt;p&gt;Hi, I attached a patch against Export/Mysql.php instead of the previous against Import/Builder.php.&lt;br/&gt;
It works on my side; can you please test it with your test suite?&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                    <attachment id="10642" name="export_mysql_patch.diff" size="765" author="nicorac" created="Sun, 13 Jun 2010 05:39:39 +0000" />
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>