Skip to content

Loading…

DBAL-944: db2 alter column produces invalid sql syntax #2188

Closed
doctrinebot opened this Issue · 6 comments

2 participants

@doctrinebot

Jira issue originally created by user rehfeldchris:

The "alter column" sql produced is always incorrect.

Example entity

<?php
/****
 * @ORM\Entity
 ****/
class Widget3
{
    /*** @ORM\Id @ORM\Column(type="integer") @ORM\GeneratedValue ***/
    protected $id;

    /*** @ORM\Column(type="string", length=20) ***/
    private $str;
}

orm:schema-tool:create produces:
CREATE TABLE Widget3 (id INTEGER GENERATED BY DEFAULT AS IDENTITY NOT NULL, str VARCHAR(20) NOT NULL, PRIMARY KEY(id));

If you then change the entity like so:

    /*** @ORM\Column(type="string", length=100) ***/
    private $str;
}

If you then run orm:schema-tool:update, it will try to run:

ALTER TABLE WIDGET3 ALTER STR str VARCHAR(100) NOT NULL;

which is invalid sql. It should be
ALTER TABLE WIDGET3 ALTER COLUMN STR SET DATA TYPE VARCHAR(100);

This renders the schema-tool inoperable in many scenarios, and causes a large portion of the db2 functional tests to fail.

@doctrinebot

Comment created by rehfeldchris:

pull request #633

@doctrinebot

Comment created by @doctrinebot:

A related Github Pull-Request [GH-633] was assigned:
#633

@doctrinebot

Comment created by @doctrinebot:

A related Github Pull-Request [GH-633] was closed:
#633

@doctrinebot

Comment created by @ocramius:

Fixed in DBAL-1019

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added the Bug label
@Ocramius Ocramius was assigned by doctrinebot
@doctrinebot doctrinebot added this to the 2.5 milestone
@doctrinebot doctrinebot closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.