New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow mariadb current_tiemstmap() default vlaue #11473

Merged
merged 1 commit into from Nov 29, 2017

Conversation

Projects
None yet
3 participants
@raul338
Contributor

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

This comment has been minimized.

Show comment
Hide comment
@codecov-io

codecov-io 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.

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

5 checks passed

codecov/patch 100% of diff hit (target 93.08%)
Details
codecov/project 93.1% (+0.01%) compared to c159efc
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
stickler-ci No lint errors found.
@markstory

This comment has been minimized.

Show comment
Hide comment
@markstory

markstory Nov 29, 2017

Member

Thanks!

Member

markstory commented Nov 29, 2017

Thanks!

@raul338 raul338 deleted the raul338:mariadb-current_timestamp branch Nov 29, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment