Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d0cb221

Browse files
authored
Refactor column schema (#223)
1 parent 91a96a7 commit d0cb221

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

.github/workflows/build.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ jobs:
6969
- name: Install db.
7070
uses: yiisoft/actions/db/subpackage-install@master
7171
with:
72-
BRANCH_NAME: ${{ github.head_ref }}
72+
BRANCH_NAME: ${{ env.BRANCH_NAME }}
7373
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
7474
CURRENT_PACKAGE: db
7575
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}

.github/workflows/mutation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ jobs:
6060
- name: Install db.
6161
uses: yiisoft/actions/db/subpackage-install@master
6262
with:
63-
BRANCH_NAME: ${{ github.head_ref }}
63+
BRANCH_NAME: ${{ env.BRANCH_NAME }}
6464
COMPOSER_ROOT_VERSION: ${{ env.COMPOSER_ROOT_VERSION }}
6565
CURRENT_PACKAGE: db
6666
FULL_BRANCH_NAME: ${{ env.FULL_BRANCH_NAME }}

src/Schema.php

+7-4
Original file line numberDiff line numberDiff line change
@@ -457,8 +457,7 @@ public function getSchemaDefaultValues(string $schema = '', bool $refresh = fals
457457
*/
458458
protected function loadColumnSchema(array $info): ColumnSchemaInterface
459459
{
460-
$column = $this->createColumnSchema();
461-
$column->name($info['name']);
460+
$column = $this->createColumnSchema($info['name']);
462461
$column->allowNull(!$info['notnull']);
463462
$column->primaryKey($info['pk'] != '0');
464463
$column->dbType(strtolower($info['type']));
@@ -603,10 +602,14 @@ private function loadTableConstraints(string $tableName, string $returnType): Co
603602
* Creates a column schema for the database.
604603
*
605604
* This method may be overridden by child classes to create a DBMS-specific column schema.
605+
*
606+
* @param string $name Name of the column.
607+
*
608+
* @return ColumnSchemaInterface
606609
*/
607-
private function createColumnSchema(): ColumnSchemaInterface
610+
private function createColumnSchema(string $name): ColumnSchemaInterface
608611
{
609-
return new ColumnSchema();
612+
return new ColumnSchema($name);
610613
}
611614

612615
/**

0 commit comments

Comments
 (0)