Skip to content

Commit f925658

Browse files
authored
Merge pull request #4721 from jeromegamez/mysql8
2 parents b3e9057 + 5a3625d commit f925658

2 files changed

Lines changed: 25 additions & 5 deletions

File tree

.github/workflows/test-phpunit.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,15 @@ jobs:
4242
matrix:
4343
php-versions: ['7.3', '7.4', '8.0']
4444
db-platforms: ['MySQLi', 'Postgre', 'SQLite3', 'SQLSRV']
45+
mysql-versions: ['5.7']
46+
include:
47+
- php-versions: 7.4
48+
db-platforms: MySQLi
49+
mysql-versions: 8.0
4550

4651
services:
4752
mysql:
48-
image: mysql:5.7
53+
image: mysql:${{ matrix.mysql-versions }}
4954
env:
5055
MYSQL_ALLOW_EMPTY_PASSWORD: yes
5156
MYSQL_DATABASE: test
@@ -133,7 +138,7 @@ jobs:
133138
DB: ${{ matrix.db-platforms }}
134139
TERM: xterm-256color
135140

136-
- if: matrix.php-versions == '7.4'
141+
- if: github.repository_owner == 'codeigniter4' && matrix.php-versions == '7.4'
137142
name: Run Coveralls
138143
run: |
139144
composer global require php-coveralls/php-coveralls:^2.4
@@ -144,6 +149,7 @@ jobs:
144149
COVERALLS_FLAG_NAME: PHP ${{ matrix.php-versions }} - ${{ matrix.db-platforms }}
145150

146151
coveralls-finish:
152+
if: github.repository_owner == 'codeigniter4'
147153
needs: [tests]
148154
runs-on: ubuntu-20.04
149155
steps:

tests/system/Database/Live/ForgeTest.php

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,16 @@ public function testCreateTableWithArrayFieldConstraints()
249249
public function testCreateTableWithNullableFieldsGivesNullDataType(): void
250250
{
251251
$this->forge->addField([
252-
'id' => ['type' => 'INT', 'constraint' => 11, 'auto_increment' => true],
253-
'name' => ['type' => 'VARCHAR', 'constraint' => 255, 'null' => true],
252+
'id' => [
253+
'type' => 'INT',
254+
'constraint' => 11,
255+
'auto_increment' => true,
256+
],
257+
'name' => [
258+
'type' => 'VARCHAR',
259+
'constraint' => 255,
260+
'null' => true,
261+
],
254262
]);
255263

256264
$createTable = $this->getPrivateMethodInvoker($this->forge, '_createTable');
@@ -620,7 +628,13 @@ public function testAddFields()
620628
$this->assertEquals($fieldsData[0]->type, 'int');
621629
$this->assertEquals($fieldsData[1]->type, 'varchar');
622630

623-
$this->assertEquals($fieldsData[0]->max_length, 11);
631+
if (version_compare($this->db->getVersion(), '8.0.17', '<'))
632+
{
633+
// As of MySQL 8.0.17, the display width attribute for integer data types
634+
// is deprecated and is not reported back anymore.
635+
// @see https://dev.mysql.com/doc/refman/8.0/en/numeric-type-attributes.html
636+
$this->assertEquals($fieldsData[0]->max_length, 11);
637+
}
624638

625639
$this->assertNull($fieldsData[0]->default);
626640
$this->assertNull($fieldsData[1]->default);

0 commit comments

Comments
 (0)