Skip to content

Conversation

@raul338
Copy link
Contributor

@raul338 raul338 commented Nov 28, 2017

Upgraded MariaDB to 10.2 on testing environment. fixtures stopped working because MariaDB reported timestamp default as current_timestamp(), generating this code when attemp to insert fixures

/src/TestSuite/Fixture/TestFixture.php (line 296)
########## DEBUG ##########
'CREATE TABLE `orden_fotos` (
`id` INTEGER(11) UNSIGNED NOT NULL AUTO_INCREMENT,
`orden_id` INTEGER(11) UNSIGNED NOT NULL,
`foto` VARCHAR(255) COLLATE utf8mb4_unicode_520_ci,
`descripcion` VARCHAR(255) COLLATE utf8mb4_unicode_520_ci,
`tipo` INTEGER(11) UNSIGNED NOT NULL COMMENT '0 problema, 1 resolucion',
`created` TIMESTAMP NOT NULL DEFAULT 'current_timestamp()',
PRIMARY KEY (`id`),
KEY `orden_id` (`orden_id`)
) ENGINE=InnoDB'
###########################
Warning Error: Fixture creation for "orden_fotos" failed "
SQLSTATE[42000]: Syntax error or access violation: 1067 Invalid default value for 'created'" in 
[/app/vendor/cakephp/cakephp/src/TestSuite/Fixture/TestFixture.php, line 308]

Baking a new Fixture resulted in same default

public $fields = [
    'id' => ['type' => 'integer', 'length' => 11, 'unsigned' => true, 'null' => false, 'default' => null, 'comment' => '', 'autoIncrement' => true, 'precision' => null],
    // ....
    'created' => ['type' => 'timestamp', 'length' => null, 'null' => false, 'default' => 'current_timestamp()', 'comment' => '', 'precision' => null],
    '_indexes' => [
        'orden_id' => ['type' => 'index', 'columns' => ['orden_id'], 'length' => []],
    ],
];

This PR attempts to fix that behavior.

@markstory markstory added this to the 3.5.7 milestone Nov 28, 2017
@markstory markstory self-assigned this Nov 28, 2017
@codecov-io
Copy link

codecov-io commented Nov 28, 2017

Codecov Report

Merging #11473 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #11473      +/-   ##
============================================
+ Coverage     93.08%    93.1%   +0.01%     
  Complexity    13013    13013              
============================================
  Files           436      436              
  Lines         33714    33759      +45     
============================================
+ Hits          31383    31431      +48     
+ Misses         2331     2328       -3
Impacted Files Coverage Δ Complexity Δ
src/Database/Schema/MysqlSchema.php 98.93% <100%> (ø) 113 <0> (ø) ⬇️
src/ORM/LazyEagerLoader.php 94.91% <0%> (-2.92%) 21% <0%> (ø)
src/Routing/RouteCollection.php 93.02% <0%> (-0.09%) 25% <0%> (ø)
src/Collection/Iterator/TreeIterator.php 100% <0%> (ø) 4% <0%> (ø) ⬇️
src/Database/Log/QueryLogger.php 100% <0%> (ø) 8% <0%> (ø) ⬇️
src/I18n/TranslatorRegistry.php 97.33% <0%> (+0.03%) 31% <0%> (ø) ⬇️
src/Database/Query.php 95.55% <0%> (+0.14%) 160% <0%> (ø) ⬇️
src/Console/CommandCollection.php 95.91% <0%> (+0.46%) 26% <0%> (ø) ⬇️
src/Cache/Engine/FileEngine.php 90.16% <0%> (+1.09%) 73% <0%> (ø) ⬇️
src/Cache/CacheRegistry.php 100% <0%> (+4%) 11% <0%> (ø) ⬇️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c159efc...a481ef7. Read the comment docs.

@markstory markstory merged commit 400b340 into cakephp:master Nov 29, 2017
@markstory
Copy link
Member

Thanks!

@raul338 raul338 deleted the mariadb-current_timestamp branch November 29, 2017 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants