Skip to content

Commit

Permalink
Bugfix for PK in schema of Column (#162)
Browse files Browse the repository at this point in the history
* Bugfix for PK in schema of Column

* styleci fix
  • Loading branch information
darkdef committed Dec 20, 2022
1 parent 3d87257 commit 662ccd6
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
53 changes: 53 additions & 0 deletions tests/Provider/SchemaProvider.php
Expand Up @@ -19,6 +19,7 @@ public function columns(): array
'type' => 'integer',
'dbType' => 'integer',
'phpType' => 'integer',
'primaryKey' => false,
'allowNull' => false,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -31,6 +32,7 @@ public function columns(): array
'type' => 'integer',
'dbType' => 'integer',
'phpType' => 'integer',
'primaryKey' => false,
'allowNull' => true,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -43,6 +45,7 @@ public function columns(): array
'type' => 'tinyint',
'dbType' => 'tinyint(3)',
'phpType' => 'integer',
'primaryKey' => false,
'allowNull' => true,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -55,6 +58,7 @@ public function columns(): array
'type' => 'smallint',
'dbType' => 'smallint(1)',
'phpType' => 'integer',
'primaryKey' => false,
'allowNull' => true,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -67,6 +71,7 @@ public function columns(): array
'type' => 'char',
'dbType' => 'char(100)',
'phpType' => 'string',
'primaryKey' => false,
'allowNull' => false,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -79,6 +84,7 @@ public function columns(): array
'type' => 'string',
'dbType' => 'varchar(100)',
'phpType' => 'string',
'primaryKey' => false,
'allowNull' => true,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -91,6 +97,7 @@ public function columns(): array
'type' => 'text',
'dbType' => 'text',
'phpType' => 'string',
'primaryKey' => false,
'allowNull' => true,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -103,6 +110,7 @@ public function columns(): array
'type' => 'double',
'dbType' => 'double(4,3)',
'phpType' => 'double',
'primaryKey' => false,
'allowNull' => false,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -115,6 +123,7 @@ public function columns(): array
'type' => 'double',
'dbType' => 'double',
'phpType' => 'double',
'primaryKey' => false,
'allowNull' => true,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -127,6 +136,7 @@ public function columns(): array
'type' => 'binary',
'dbType' => 'blob',
'phpType' => 'resource',
'primaryKey' => false,
'allowNull' => true,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -139,6 +149,7 @@ public function columns(): array
'type' => 'decimal',
'dbType' => 'decimal(5,2)',
'phpType' => 'string',
'primaryKey' => false,
'allowNull' => true,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -151,6 +162,7 @@ public function columns(): array
'type' => 'timestamp',
'dbType' => 'timestamp',
'phpType' => 'string',
'primaryKey' => false,
'allowNull' => false,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -163,6 +175,7 @@ public function columns(): array
'type' => 'boolean',
'dbType' => 'tinyint(1)',
'phpType' => 'boolean',
'primaryKey' => false,
'allowNull' => false,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -175,6 +188,7 @@ public function columns(): array
'type' => 'boolean',
'dbType' => 'tinyint(1)',
'phpType' => 'boolean',
'primaryKey' => false,
'allowNull' => true,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -187,6 +201,7 @@ public function columns(): array
'type' => 'timestamp',
'dbType' => 'timestamp',
'phpType' => 'string',
'primaryKey' => false,
'allowNull' => false,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -196,6 +211,38 @@ public function columns(): array
'defaultValue' => new Expression('CURRENT_TIMESTAMP'),
],
],
'tableName' => 'type',
],
[
[
'id' => [
'type' => 'integer',
'dbType' => 'integer',
'phpType' => 'integer',
'primaryKey' => true,
'allowNull' => false,
'autoIncrement' => true,
'enumValues' => null,
'size' => null,
'precision' => null,
'scale' => null,
'defaultValue' => null,
],
'type' => [
'type' => 'string',
'dbType' => 'varchar(255)',
'phpType' => 'string',
'primaryKey' => false,
'allowNull' => false,
'autoIncrement' => false,
'enumValues' => null,
'size' => 255,
'precision' => 255,
'scale' => null,
'defaultValue' => null,
],
],
'animal',
],
];
}
Expand All @@ -209,6 +256,7 @@ public function columnsTypeBit(): array
'type' => 'boolean',
'dbType' => 'bit(1)',
'phpType' => 'boolean',
'primaryKey' => false,
'allowNull' => false,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -221,6 +269,7 @@ public function columnsTypeBit(): array
'type' => 'boolean',
'dbType' => 'bit(1)',
'phpType' => 'boolean',
'primaryKey' => false,
'allowNull' => true,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -233,6 +282,7 @@ public function columnsTypeBit(): array
'type' => 'integer',
'dbType' => 'bit(32)',
'phpType' => 'integer',
'primaryKey' => false,
'allowNull' => false,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -245,6 +295,7 @@ public function columnsTypeBit(): array
'type' => 'integer',
'dbType' => 'bit(32)',
'phpType' => 'integer',
'primaryKey' => false,
'allowNull' => true,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -257,6 +308,7 @@ public function columnsTypeBit(): array
'type' => 'bigint',
'dbType' => 'bit(64)',
'phpType' => 'integer',
'primaryKey' => false,
'allowNull' => false,
'autoIncrement' => false,
'enumValues' => null,
Expand All @@ -269,6 +321,7 @@ public function columnsTypeBit(): array
'type' => 'bigint',
'dbType' => 'bit(64)',
'phpType' => 'integer',
'primaryKey' => false,
'allowNull' => true,
'autoIncrement' => false,
'enumValues' => null,
Expand Down
4 changes: 2 additions & 2 deletions tests/SchemaTest.php
Expand Up @@ -35,9 +35,9 @@ public function testColumnComment(): void
/**
* @dataProvider \Yiisoft\Db\Sqlite\Tests\Provider\SchemaProvider::columns()
*/
public function testColumnSchema(array $columns): void
public function testColumnSchema(array $columns, string $tableName): void
{
parent::testColumnSchema($columns);
parent::testColumnSchema($columns, $tableName);
}

/**
Expand Down

0 comments on commit 662ccd6

Please sign in to comment.