DBAL-632: MSSQL Diff #1849

Closed
doctrinebot opened this Issue Oct 15, 2013 · 10 comments

2 participants

@doctrinebot

Jira issue originally created by user smasala:

When I run doctrine:migrations:diff on an MSSQL database, I get a load of pointless statements everytime - i.e VARCHAR(MAX) NULL

    $this->addSql("ALTER TABLE attachment ALTER COLUMN dec*generic*field VARCHAR(MAX) NULL");
    $this->addSql("ALTER TABLE attachment ALTER COLUMN dec*custom*field VARCHAR(MAX) NULL");
    $this->addSql("ALTER TABLE category ALTER COLUMN dec*generic*field VARCHAR(MAX) NULL");
    $this->addSql("ALTER TABLE category ALTER COLUMN dec*custom*field VARCHAR(MAX) NULL");

Is this a bug?

P.s this doesn't happen on our MySQL db


according to stof:

Then it means it is not an issue in the migrations library but in the DBAL schema comparator

@doctrinebot

Comment created by stof:

Can you paste your ORM mapping for these columns ?

@doctrinebot

Comment created by smasala:

@ORM\Column(name="decgenericfield", type="object", nullable=true)
@ORM\Column(name="deccustomfield", type="object", nullable=true)

@doctrinebot

Comment created by stof:

This is happening because the primary mapping of a database VARCHAR field is the Doctrine StringType. But the doctrine ObjectType also uses a VARCHAR for its storage in the database.
On platforms supporting column comments, Doctrine puts a special comment to identify the doctrine type associated to the field, so that the schema tool can identify it properly when comparing the DB schema to the ORM schema.

the difference in your case is that MySQL supports inline column comments while the SqlServer platform does not.

@doctrinebot

Comment created by smasala:

and how can change that? so that every time we call migrations:diff those statements for each table is no longer unnecessary created.

@doctrinebot

Comment created by @deeky666:

There is another issue that referes to the exact same issue.

@doctrinebot

Comment created by @deeky666:

A WIP PR is opended to support SQL Server comments:

#426

@doctrinebot

Comment created by @doctrinebot:

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

@doctrinebot

Comment created by @deeky666:

Fixed in commit: 28264a1

@doctrinebot

Issue was closed with resolution "Fixed"

@doctrinebot doctrinebot added the Bug label Dec 7, 2015
@deeky666 deeky666 was assigned by doctrinebot Dec 7, 2015
@doctrinebot doctrinebot added this to the 2.5 milestone Dec 7, 2015
@doctrinebot doctrinebot closed this Dec 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment