Skip to content

Commit 66f9a25

Browse files
authored
Add source of column information (#453)
1 parent ef476f8 commit 66f9a25

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
- Enh #432, #433: Update `DMLQueryBuilder::update()` method to adapt changes in `yiisoft/db` (@rustamwin, @Tigrov)
5757
- Enh #439: Move "Packets out of order" warning suppression from Yii DB (@vjik)
5858
- New #448: Add enumeration column type support (@vjik)
59+
- New #453: Add source of column information (@Tigrov)
5960

6061
## 1.2.0 March 21, 2024
6162

src/Schema.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
namespace Yiisoft\Db\Mysql;
66

7+
use Yiisoft\Db\Constant\ColumnInfoSource;
78
use Yiisoft\Db\Constant\ColumnType;
89
use Yiisoft\Db\Constant\ReferentialAction;
910
use Yiisoft\Db\Constraint\ForeignKey;
@@ -269,7 +270,7 @@ protected function loadResultColumn(array $metadata): ?ColumnInterface
269270
default => strtolower($metadata['native_type']),
270271
};
271272

272-
$columnInfo = [];
273+
$columnInfo = ['source' => ColumnInfoSource::QUERY_RESULT];
273274

274275
if (!empty($metadata['table'])) {
275276
$columnInfo['table'] = $metadata['table'];
@@ -456,6 +457,7 @@ private function loadColumn(array $info): ColumnInterface
456457
'notNull' => $info['is_nullable'] !== 'YES',
457458
'primaryKey' => $info['column_key'] === 'PRI',
458459
'schema' => $info['schema'],
460+
'source' => ColumnInfoSource::TABLE_SCHEMA,
459461
'table' => $info['table'],
460462
'unique' => $info['column_key'] === 'UNI',
461463
];

0 commit comments

Comments
 (0)