Skip to content

Commit

Permalink
Unbreak mysql tests and fix one more issue with CURRENT_TIMESTAMP vs …
Browse files Browse the repository at this point in the history
…current_timestamp()
  • Loading branch information
nicosp committed Dec 11, 2024
1 parent 0c70293 commit 57133d7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
4 changes: 2 additions & 2 deletions tests/TestCase/Db/Adapter/MysqlAdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -531,11 +531,11 @@ public function testAddTimestampsFeatureFlag()
$this->assertEquals('datetime', $columns[1]->getType());
$this->assertEquals('', $columns[1]->getUpdate());
$this->assertFalse($columns[1]->isNull());
$this->assertEquals('CURRENT_TIMESTAMP', $columns[1]->getDefault());
$this->assertContains($columns[1]->getDefault(), ['CURRENT_TIMESTAMP', 'current_timestamp()']);

$this->assertEquals('updated', $columns[2]->getName());
$this->assertEquals('datetime', $columns[2]->getType());
$this->assertEquals('CURRENT_TIMESTAMP', $columns[2]->getUpdate());
$this->assertContains($columns[2]->getUpdate(), ['CURRENT_TIMESTAMP', 'current_timestamp()']);
$this->assertTrue($columns[2]->isNull());
$this->assertNull($columns[2]->getDefault());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@

class TheDiffAddRemoveMysql extends BaseMigration
{
private function isMariaDB(): bool
{
$version = $this->adapter->getConnection()->getDriver()->version();

return version_compare($version, '10.0', '>=');
}

/**
* Up Method.
*
Expand All @@ -36,7 +29,7 @@ public function up(): void
$this->table('articles')
->addColumn('the_text', 'text', [
'after' => 'title',
'collation' => $this->isMariaDB() ? 'utf8mb4_unicode_520_ci' : 'utf8mb4_0900_ai_ci',
'collation' => 'utf8mb4_0900_ai_ci',
'default' => null,
'length' => null,
'null' => false,
Expand Down

0 comments on commit 57133d7

Please sign in to comment.