Browse Source

yii\db\mssql\QueryBuilder - TYPE_TEXT mapped to NVARCHAR(MAX)

tags/2.0.10
SilverFire - Dmitry Naumenko 8 years ago
parent
commit
e6eed9a7c9
No known key found for this signature in database
GPG Key ID: 39DD917A92B270A
  1. 2
      framework/CHANGELOG.md
  2. 42
      framework/UPGRADE.md
  3. 4
      framework/db/mssql/QueryBuilder.php

2
framework/CHANGELOG.md

@ -60,7 +60,7 @@ Yii Framework 2 Change Log
- Enh #11494: `yii.reloadableScripts` now support wildcards with `*` character (silverfire)
- Enh #11658: Added argument to `yii\grid\ActionColumn::urlCreator` callback, which holds reference to the column instance (klimov-paul)
- Enh #11804: Added `yii\behaviors\AttributeTypecastBehavior` for maintaining of strict ActiveRecord attribute types (klimov-paul)
- Enh #11835: Fixed NTEXT in `\yii\db\mssql\QueryBuilder::$typeMap` that is being deprecated in MSSQL (githubjeka)
- Enh #11835: Fixed `\yii\db\mssql\QueryBuilder::$typeMap[TYPE_TEXT]` - `NTEXT` data type was deprecated in MSSQL (githubjeka)
- Enh #11950: Improve `yii\helpers\BaseArrayHelper::keyExists()` speed (egorio)
- Enh #11979: Added `yii\mutex\OracleMutex` which implements mutex "lock" mechanism via Oracle locks (zlakomanoff)
- Enh #12028: Add -h|--help option to console command to display help information (pana1990)

42
framework/UPGRADE.md

@ -20,11 +20,9 @@ Upgrade from Yii 2.0.9
* RBAC: `getChildRoles()` method was added to `\yii\rbac\ManagerInterface`. If you've implemented your own RBAC manager
you need to implement new method.
* NTEXT data type was marked as deprecated (https://msdn.microsoft.com/en-us/library/ms187993.aspx) so
`\yii\db\Schema::TYPE_TEXT` was changed from `'ntext'` to `'nvarchar'`. By default `nvarchar` defines a
string of length 4000. If you need `Schema::TYPE_TEXT = nvarchar(max)`, you can adjust it in your code.
It's not like that by default because `MAX` keyword is new to SQL Server 2005.
* Microsoft SQL `NTEXT` data type [was marked as deprecated](https://msdn.microsoft.com/en-us/library/ms187993.aspx) so
`\yii\db\mssql\Schema::TYPE_TEXT` was changed from `'ntext'` to `'nvarchar(max)'
Upgrade from Yii 2.0.8
----------------------
@ -89,7 +87,7 @@ Upgrade from Yii 2.0.6
* The context of `yii.confirm` JavaScript function was changed from `yii` object to the DOM element which triggered
the event.
- If you overrode the `yii.confirm` function and accessed the `yii` object through `this`, you must access it
with global variable `yii` instead.
@ -135,7 +133,7 @@ Upgrade from Yii 2.0.3
* Updated dependency to `cebe/markdown` to version `1.1.x`.
If you need stick with 1.0.x, you can specify that in your `composer.json` by
adding the following line in the `require` section:
```json
"cebe/markdown": "~1.0.0",
```
@ -162,7 +160,7 @@ Upgrade from Yii 2.0.0
* Upgraded Twitter Bootstrap to [version 3.3.x](http://blog.getbootstrap.com/2014/10/29/bootstrap-3-3-0-released/).
If you need to use an older version (i.e. stick with 3.2.x) you can specify that in your `composer.json` by
adding the following line in the `require` section:
```json
"bower-asset/bootstrap": "3.2.*",
```
@ -177,13 +175,13 @@ Upgrade from Yii 2.0 RC
This causes trouble because the formatter uses `Yii::$app->timeZone` as the default values for output so no timezone conversion
was possible. If your timestamps are stored in the database without a timezone identifier you have to ensure they are in UTC or
add a timezone identifier explicitly.
* `yii\bootstrap\Collapse` is now encoding labels by default. `encode` item option and global `encodeLabels` property were
introduced to disable it. Keys are no longer used as labels. You need to remove keys and use `label` item option instead.
* The `yii\base\View::beforeRender()` and `yii\base\View::afterRender()` methods have two extra parameters `$viewFile`
and `$params`. If you are overriding these methods, you should adjust the method signature accordingly.
* If you've used `asImage` formatter i.e. `Yii::$app->formatter->asImage($value, $alt);` you should change it
to `Yii::$app->formatter->asImage($value, ['alt' => $alt]);`.
@ -215,9 +213,9 @@ Upgrade from Yii 2.0 Beta
}
}
```
It is also a good idea to upgrade composer itself to the latest version if you see any problems:
```
php composer.phar self-update
```
@ -309,7 +307,7 @@ Upgrade from Yii 2.0 Beta
doesn't have `cookieValidationKey` property.
* `yii\rbac\PhpManager` now stores data in three separate files instead of one. In order to convert old file to
new ones save the following code as `convert.php` that should be placed in the same directory your `rbac.php` is in:
new ones save the following code as `convert.php` that should be placed in the same directory your `rbac.php` is in:
```php
<?php
@ -317,16 +315,16 @@ new ones save the following code as `convert.php` that should be placed in the s
$itemsFile = 'items.php';
$assignmentsFile = 'assignments.php';
$rulesFile = 'rules.php';
$oldData = include $oldFile;
function saveToFile($data, $fileName) {
$out = var_export($data, true);
$out = "<?php\nreturn " . $out . ';';
$out = str_replace(['array (', ')'], ['[', ']'], $out);
file_put_contents($fileName, $out);
}
$items = [];
$assignments = [];
if (isset($oldData['items'])) {
@ -340,16 +338,16 @@ new ones save the following code as `convert.php` that should be placed in the s
$items[$name] = $data;
}
}
$rules = [];
if (isset($oldData['rules'])) {
$rules = $oldData['rules'];
}
saveToFile($items, $itemsFile);
saveToFile($assignments, $assignmentsFile);
saveToFile($rules, $rulesFile);
echo "Done!\n";
```
@ -384,7 +382,7 @@ new ones save the following code as `convert.php` that should be placed in the s
}, $duration, $dependency);
```
* Due to significant changes to security you need to upgrade your code to use `\yii\base\Security` component instead of
helper. If you have any data encrypted it should be re-encrypted. In order to do so you can use old security helper
[as explained by @docsolver at github](https://github.com/yiisoft/yii2/issues/4461#issuecomment-50237807).
@ -481,6 +479,6 @@ new ones save the following code as `convert.php` that should be placed in the s
* The signature of `View::registerJsFile()` and `View::registerCssFile()` has changed. The `$depends` and `$position`
paramaters have been merged into `$options`. The new signatures are as follows:
- `registerJsFile($url, $options = [], $key = null)`
- `registerCssFile($url, $options = [], $key = null)`

4
framework/db/mssql/QueryBuilder.php

@ -28,9 +28,7 @@ class QueryBuilder extends \yii\db\QueryBuilder
Schema::TYPE_UBIGPK => 'bigint IDENTITY PRIMARY KEY',
Schema::TYPE_CHAR => 'nchar(1)',
Schema::TYPE_STRING => 'nvarchar(255)',
// If you need Schema::TYPE_TEXT = nvarchar(max), you can change in your code
// MAX keyword is new to SQL Server 2005 http://stackoverflow.com/questions/16472610/max-nvarchar-length
Schema::TYPE_TEXT => 'nvarchar(4000)',
Schema::TYPE_TEXT => 'nvarchar(max)',
Schema::TYPE_SMALLINT => 'smallint',
Schema::TYPE_INTEGER => 'int',
Schema::TYPE_BIGINT => 'bigint',

Loading…
Cancel
Save