From 44831d26e2c2bb5583f5e7aa512b0e3a719117d6 Mon Sep 17 00:00:00 2001 From: Carsten Schmitz Date: Tue, 19 Jun 2012 11:43:56 +0200 Subject: [PATCH] Dev MSSQL breaks on Active Record when column has a default value of NULL - see https://github.com/yiisoft/yii/issues/842 --- .../db/schema/mssql/CMssqlColumnSchema.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/framework/db/schema/mssql/CMssqlColumnSchema.php b/framework/db/schema/mssql/CMssqlColumnSchema.php index 88dc6540640..32c7f424fe8 100644 --- a/framework/db/schema/mssql/CMssqlColumnSchema.php +++ b/framework/db/schema/mssql/CMssqlColumnSchema.php @@ -19,6 +19,24 @@ */ class CMssqlColumnSchema extends CDbColumnSchema { + + + + /** + * Initializes the column with its DB type and default value. + * This sets up the column's PHP type, size, precision, scale as well as default value. + * @param string $dbType the column's DB type + * @param mixed $defaultValue the default value + */ + public function init($dbType, $defaultValue) + { + if ($defaultValue=='(NULL)') + { + $defaultValue=null; + } + parent::init($dbType, $defaultValue); + } + /** * Extracts the PHP type from DB type. * @param string $dbType DB type