<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sun May 19 10:42:39 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/DBAL-434/DBAL-434.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>[DBAL-434] Incorrect type mapping on Oracle Platform</title>
                <link>http://www.doctrine-project.org/jira/browse/DBAL-434</link>
                <project id="10040" key="DBAL">Doctrine DBAL</project>
                        <description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;I&apos;m noticed a strange behaviour when I executed a migration for my Oracle database. Doctrine detects changes on all &lt;tt&gt;date&lt;/tt&gt; columns, generating queries like:&lt;/p&gt;

&lt;p&gt;&lt;tt&gt;ALTER TABLE the_table MODIFY (the_date DATE DEFAULT NULL);&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;even if the entity property was not modified. Check in out the Doctrine 2 source code I&apos;ve detected that Doctrine map the &lt;tt&gt;DATE&lt;/tt&gt; Oracle columns as &lt;tt&gt;datetime&lt;/tt&gt; type, but entity &lt;tt&gt;date&lt;/tt&gt; property are mapped as &lt;tt&gt;date&lt;/tt&gt; (as it should be), so Doctrine believes that entity property and column type are different and generate the alter query.&lt;/p&gt;

&lt;p&gt;I found the problem on the method Doctrine\DBAL\Platforms\OraclePlatform::initializeDoctrineTypeMappings, when it say &lt;tt&gt;&apos;date&apos; =&amp;gt; &apos;datetime&apos;&lt;/tt&gt; should say &lt;tt&gt;&apos;date&apos; =&amp;gt; &apos;date&apos;&lt;/tt&gt;, that fix the migration problem and does not break my application.&lt;/p&gt;

&lt;p&gt;Was a typo?&lt;/p&gt;

&lt;p&gt;Thanks!&lt;/p&gt;</description>
                <environment>Oracle 10g on Windows, using Doctrine 2 with Symfony2</environment>
            <key id="14436">DBAL-434</key>
            <summary>Incorrect type mapping on Oracle Platform</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="2" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/critical.png">Critical</priority>
                    <status id="5" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/resolved.png">Resolved</status>
                    <resolution id="7">Can&apos;t Fix</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="eagleoneraptor">Dami&#225;n Nohales</reporter>
                        <labels>
                    </labels>
                <created>Wed, 30 Jan 2013 19:31:43 +0000</created>
                <updated>Sun, 17 Feb 2013 13:55:08 +0000</updated>
                    <resolved>Wed, 30 Jan 2013 20:07:39 +0000</resolved>
                                                            <component>Platforms</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="19442" author="beberlei" created="Wed, 30 Jan 2013 20:07:39 +0000"  >&lt;p&gt;The problem is that Oracle has a &quot;DATE&quot; type, which is actually a DATETIME. That is why we map it to Doctrine&apos;s Datetime type.&lt;/p&gt;

&lt;p&gt;As a workaround, you can set this information yourself using:&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;
$conn-&amp;gt;getDatabasePlatform()-&amp;gt;registerDoctrineTypeMapping(&apos;date&apos;, &apos;date&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Be aware this is a global change for all columns. If you map DateTimes to a TIMESTAMP field you are good to go though.&lt;/p&gt;</comment>
                    <comment id="19549" author="johnkary" created="Sun, 17 Feb 2013 07:57:29 +0000"  >&lt;p&gt;I ran into this same issue with the default &lt;tt&gt;OraclePlatform&lt;/tt&gt; configuration. I was trying to run &lt;tt&gt;doctrine:schema:update --force&lt;/tt&gt; from the Symfony2 Console on my Oracle database, and ALTER statements were generated for some DATE columns that were fully up to date when looking at the actual table.&lt;/p&gt;

&lt;p&gt;But the major issue I ran into was these unnecessary ALTER statements were for DATE columns with NOT NULL constraints, resulting in a query like &lt;tt&gt;ALTER TABLE your_table MODIFY (created_at_date  DATE NOT NULL);&lt;/tt&gt; Yet when running this query, Oracle throws an error: &lt;tt&gt;ORA-01442: column to be modified to NOT NULL is already NOT NULL&lt;/tt&gt;. So I could no longer use &lt;tt&gt;doctrine:schema:update&lt;/tt&gt; to update my schema during development against Oracle.&lt;/p&gt;

&lt;p&gt;While technically correct, Oracle DATE types actually store time data in addition to date data, I don&apos;t agree that this should be considered Doctrine&apos;s default behavior.&lt;/p&gt;

&lt;p&gt;I believe Oracle DATE columns should be date-only (e.g. Day, Month, Year) and time data should be disregarded. All other drivers except SQLServer map &quot;date&quot; fields to Doctrine&apos;s &quot;date&quot; type. I would rather see someone wanting to store time data with their DATE field need to make the suggested change, instead of the other way around:&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;
$conn-&amp;gt;getDatabasePlatform()-&amp;gt;registerDoctrineTypeMapping(&apos;date&apos;, &apos;datetime&apos;);
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Oracle 11g Release 1 DATE type docs: &lt;a href=&quot;http://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#i1847&quot; class=&quot;external-link&quot;&gt;http://docs.oracle.com/cd/B28359_01/server.111/b28318/datatype.htm#i1847&lt;/a&gt;)&lt;/p&gt;</comment>
                    <comment id="19550" author="beberlei" created="Sun, 17 Feb 2013 13:55:08 +0000"  >&lt;p&gt;Well the other thing is, that we cannot change this for BC reasons.&lt;/p&gt;

&lt;p&gt;We could introduce a new platform that solves this issue though.&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>