<!-- 
RSS generated by JIRA (5.2.7#850-sha1:b2af0c8dc8537b36121c6a579fabbdf79fc919e5) at Sat May 25 04:42:51 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-352/DBAL-352.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-352] Running doctrine:schema:update throws an exception the first time, succeeds the second time.</title>
                <link>http://www.doctrine-project.org/jira/browse/DBAL-352</link>
                <project id="10040" key="DBAL">Doctrine DBAL</project>
                        <description>&lt;p&gt;Shell output from my symfony project:&lt;br/&gt;
 $ app/console doctrine:schema:update --force&lt;br/&gt;
 Updating database schema...&lt;/p&gt;

&lt;p&gt;  &lt;span class=&quot;error&quot;&gt;&amp;#91;Doctrine\DBAL\DBALException&amp;#93;&lt;/span&gt;&lt;br/&gt;
  An exception occurred while executing &apos;ALTER TABLE Tn ADD CONSTRAINT FK_3504C6F07D3656A4 FOREIGN KEY (account) REFERENCES Account (id)&apos;:&lt;/p&gt;

&lt;p&gt;  SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42000&amp;#93;&lt;/span&gt;: Syntax error or access violation: 1072 Key column &apos;account&apos; doesn&apos;t exist in table&lt;/p&gt;

&lt;p&gt;  &lt;span class=&quot;error&quot;&gt;&amp;#91;PDOException&amp;#93;&lt;/span&gt;&lt;br/&gt;
  SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42000&amp;#93;&lt;/span&gt;: Syntax error or access violation: 1072 Key column &apos;account&apos; doesn&apos;t exist in table&lt;/p&gt;

&lt;p&gt; doctrine:schema:update &lt;span class=&quot;error&quot;&gt;&amp;#91;--complete&amp;#93;&lt;/span&gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;--dump-sql&amp;#93;&lt;/span&gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;--force&amp;#93;&lt;/span&gt; [--em&lt;span class=&quot;error&quot;&gt;&amp;#91;=&amp;quot;...&amp;quot;&amp;#93;&lt;/span&gt;]&lt;/p&gt;

&lt;p&gt; $ app/console doctrine:schema:update --force&lt;br/&gt;
 Updating database schema...&lt;br/&gt;
 Database schema updated successfully! &quot;7&quot; queries were executed&lt;br/&gt;
 $&lt;/p&gt;</description>
                <environment></environment>
            <key id="14065">DBAL-352</key>
            <summary>Running doctrine:schema:update throws an exception the first time, succeeds the second time.</summary>
                <type id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/issuetypes/bug.png">Bug</type>
                                <priority id="4" iconUrl="http://www.doctrine-project.org/jira/images/icons/priorities/minor.png">Minor</priority>
                    <status id="1" iconUrl="http://www.doctrine-project.org/jira/images/icons/statuses/open.png">Open</status>
                    <resolution id="-1">Unresolved</resolution>
                    <security id="10000">All</security>
                        <assignee username="beberlei">Benjamin Eberlei</assignee>
                                <reporter username="hexmode">Mark A. Hershberger</reporter>
                        <labels>
                    </labels>
                <created>Tue, 25 Sep 2012 13:27:26 +0000</created>
                <updated>Tue, 25 Sep 2012 14:35:32 +0000</updated>
                                                                    <component>Schema Managers</component>
                        <due></due>
                    <votes>0</votes>
                        <watches>3</watches>
                        <comments>
                    <comment id="18724" author="stof" created="Tue, 25 Sep 2012 13:52:11 +0000"  >&lt;p&gt;Please run the command with the &lt;tt&gt;&amp;#45;&amp;#45;dump&amp;#45;sql&lt;/tt&gt; option instead of &lt;tt&gt;&amp;#45;&amp;#45;force&lt;/tt&gt; each time before launching it for real, to be able to see which SQL queries are executed in both cases&lt;/p&gt;</comment>
                    <comment id="18725" author="hexmode" created="Tue, 25 Sep 2012 14:07:52 +0000"  >&lt;p&gt;I&apos;m not sure how to roll back the changes so that I can reproduce this.&lt;/p&gt;</comment>
                    <comment id="18726" author="hexmode" created="Tue, 25 Sep 2012 14:18:47 +0000"  >&lt;p&gt;Got it after a little poking around with git.  Rolling back to a commit in my code before the one given here didn&apos;t didn&apos;t show this reproduce this.&lt;/p&gt;


&lt;p&gt;$ php app/console doctrine:schema:create        &lt;br/&gt;
ATTENTION: This operation should not be executed in a production environment.&lt;/p&gt;

&lt;p&gt;Creating database schema...&lt;br/&gt;
Database schema created successfully!&lt;/p&gt;

&lt;p&gt;$ git checkout d686a39fb664dca540167e1b3e96ea0ffd67bc00&lt;br/&gt;
Previous HEAD position was 0510a59... * First round of Customer-to-Accounts (1:n) mapping done * Start of Customer-to-Tn and Tn-to-Account mapping&lt;br/&gt;
HEAD is now at d686a39... * A little debugging for Entity::Customer::hasEntitlement * Add FK for Customer to Tn&lt;/p&gt;

&lt;p&gt;$ php app/console doctrine:schema:update --dump-sql    &lt;br/&gt;
ALTER TABLE Account CHANGE guid guid VARCHAR(255) NOT NULL;&lt;br/&gt;
ALTER TABLE Tn DROP FOREIGN KEY FK_3504C6F09B6B5FBA;&lt;br/&gt;
DROP INDEX IDX_3504C6F09B6B5FBA ON Tn;&lt;br/&gt;
ALTER TABLE Tn ADD tnType VARCHAR(10) NOT NULL, CHANGE account_id customer INT DEFAULT NULL;&lt;br/&gt;
ALTER TABLE Tn ADD CONSTRAINT FK_3504C6F07D3656A4 FOREIGN KEY (account) REFERENCES Account (id);&lt;br/&gt;
ALTER TABLE Tn ADD CONSTRAINT FK_3504C6F081398E09 FOREIGN KEY (customer) REFERENCES Customer (id);&lt;br/&gt;
CREATE INDEX IDX_3504C6F07D3656A4 ON Tn (account);&lt;br/&gt;
CREATE INDEX IDX_3504C6F081398E09 ON Tn (customer);&lt;br/&gt;
ALTER TABLE Customer CHANGE guid guid VARCHAR(255) NOT NULL, CHANGE authGuid authGuid VARCHAR(255) NOT NULL&lt;br/&gt;
mah@debian:~/comcast$ php app/console doctrine:schema:update --force       &lt;br/&gt;
Updating database schema...&lt;/p&gt;

&lt;p&gt;  &lt;span class=&quot;error&quot;&gt;&amp;#91;Doctrine\DBAL\DBALException&amp;#93;&lt;/span&gt;          &lt;br/&gt;
  An exception occurred while executing &apos;ALTER TABLE Tn ADD CONSTRAINT FK_3504C6F07D3656A4 FOREIGN KEY (account)&lt;br/&gt;
  REFERENCES Account (id)&apos;:&lt;/p&gt;

&lt;p&gt;  SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42000&amp;#93;&lt;/span&gt;: Syntax error or access violation: 1072 Key column &apos;account&apos; doesn&apos;t exist in table&lt;/p&gt;

&lt;p&gt;  &lt;span class=&quot;error&quot;&gt;&amp;#91;PDOException&amp;#93;&lt;/span&gt;                                                                                       &lt;br/&gt;
  SQLSTATE&lt;span class=&quot;error&quot;&gt;&amp;#91;42000&amp;#93;&lt;/span&gt;: Syntax error or access violation: 1072 Key column &apos;account&apos; doesn&apos;t exist in table  &lt;/p&gt;

&lt;p&gt;doctrine:schema:update &lt;span class=&quot;error&quot;&gt;&amp;#91;--complete&amp;#93;&lt;/span&gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;--dump-sql&amp;#93;&lt;/span&gt; &lt;span class=&quot;error&quot;&gt;&amp;#91;--force&amp;#93;&lt;/span&gt; [--em&lt;span class=&quot;error&quot;&gt;&amp;#91;=&amp;quot;...&amp;quot;&amp;#93;&lt;/span&gt;]&lt;/p&gt;


&lt;p&gt;$ php app/console doctrine:schema:update --dump-sql&lt;br/&gt;
ALTER TABLE Account CHANGE guid guid VARCHAR(255) NOT NULL;&lt;br/&gt;
ALTER TABLE Tn ADD account INT DEFAULT NULL;&lt;br/&gt;
ALTER TABLE Tn ADD CONSTRAINT FK_3504C6F07D3656A4 FOREIGN KEY (account) REFERENCES Account (id);&lt;br/&gt;
ALTER TABLE Tn ADD CONSTRAINT FK_3504C6F081398E09 FOREIGN KEY (customer) REFERENCES Customer (id);&lt;br/&gt;
CREATE INDEX IDX_3504C6F07D3656A4 ON Tn (account);&lt;br/&gt;
CREATE INDEX IDX_3504C6F081398E09 ON Tn (customer);&lt;br/&gt;
ALTER TABLE Customer CHANGE guid guid VARCHAR(255) NOT NULL, CHANGE authGuid authGuid VARCHAR(255) NOT NULL&lt;/p&gt;

&lt;p&gt;$ php app/console doctrine:schema:update --force   &lt;br/&gt;
Updating database schema...&lt;br/&gt;
Database schema updated successfully! &quot;7&quot; queries were executed&lt;/p&gt;

&lt;p&gt;$ &lt;/p&gt;</comment>
                    <comment id="18728" author="stof" created="Tue, 25 Sep 2012 14:35:32 +0000"  >&lt;p&gt;hmm, the first update seems to miss the addition of the account field, which is done the second time through &lt;tt&gt;ALTER TABLE Tn ADD account INT DEFAULT NULL;&lt;/tt&gt;&lt;/p&gt;</comment>
                </comments>
                    <attachments>
                </attachments>
            <subtasks>
        </subtasks>
        </item>
</channel>
</rss>