#6225: timestamp issue with 'cake schema'
---------------------------+------------------------------------------------
    Reporter:  verbal      |          Type:  Bug   
      Status:  new         |      Priority:  Medium
   Milestone:  1.2.x.x     |     Component:  Schema
     Version:  1.2 Final   |      Severity:  Normal
    Keywords:              |   Php_version:  PHP 5 
Cake_version:  1.2.2.8120  |  
---------------------------+------------------------------------------------
 There is an issue with 'created' column in MySQL when it is timestamp and
 default value is set to CURRENT_TIMESTAMP. I wrote about it in ticket
 #6205.
 When I have 'created' column set as timestamp and default value set to
 CURRENT_TIMESTAMP and run 'cake schema create' it create such a line:

 {{{
 'created' => array('type' => 'timestamp', 'null' => false, 'default' =>
 'CURRENT_TIMESTAMP'),
 }}}

 then when I run 'cake schema run create' it gives me an error:

 {{{
 1067: Invalid default value for 'created'
 }}}

 Problem is with create table statement generated by cake, where default
 value for timestamp is 'CURRENT_TIMESTAMP' and it should be
 CURRENT_TIMESTAMP (without single quotes) as suggested in
 http://dev.mysql.com/doc/refman/5.0/en/timestamp.html.

 You can recreate this error changing $fields in cake_test_fixture.test.php
 to:

 {{{
 var $fields = array(
     'id' => array('type' => 'integer',  'key' => 'primary'),
     'name' => array('type' => 'text', 'length' => '255'),
     'created' => array('type' => 'timestamp', 'default' =>
 'CURRENT_TIMESTAMP'),
 );
 }}}

 and running 'libs/CakeTestFixture'.

 I've run it using mysql and mysqli driver. I've MySQL version 5.0.77-log
 and cake 8127.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6225>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" group.
To post to this group, send email to tickets-cakephp@googlegroups.com
To unsubscribe from this group, send email to 
tickets-cakephp+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to