Yii2: Migration: MS SQL alterColumn with ->null() syntax error

Created on 12 Apr 2017  路  4Comments  路  Source: yiisoft/yii2

What steps will reproduce the problem?

In migration if I do:
$this->alterColumn('table','column',$this->integer()->null());

What is the expected result?

IMHO the column should be created without error with:
ALTER TABLE [table] ALTER COLUMN [column] integer NULL

What do you get instead?

SYNTAX ERROR:
ALTER TABLE [table] ALTER COLUMN [column] integer NULL DEFAULT NULL

Additional info

The DEFAULT NULL should not be there!!!
Might be related to #12077 and #11158

MSSQL db to be verified bug

Most helpful comment

MSSQL as said in the title.

All 4 comments

I temporarily solve this by doing:
$this->alterColumn('table','column',$this->integer().' NULL');

which DBMS is that? MySQL?

MSSQL as said in the title.

I also have this issue on MySQL:
access_token varchar(100) NULL DEFAULT NULL

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jpodpro picture jpodpro  路  3Comments

chaintng picture chaintng  路  3Comments

indicalabs picture indicalabs  路  3Comments

AstRonin picture AstRonin  路  3Comments

MUTOgen picture MUTOgen  路  3Comments