Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorThijs
     

    I'm not sure you could call this a bug, but if you're validating uniqueness on a date field using MySQL it is something to be aware of.

    In the installer: 'datum' is a ordinary date field (and not a datetime field. I didn't need hours and minutes)

    function up_1()
    {
        $this->createTable('meterreadingdates', "
          id,
          user_id,
          datum date
        ");
    }
    

    There should be only one record for every 'datum', so in the model is a validation on uniqueness.

    class Meterreadingdate extends ActiveRecord
    {
        var $belongs_to = 'user';
        var $has_many   = 'meterreadings';
    
        function validate(){
            $this->validatesUniquenessOf('datum');
        }
    }
    

    But, here it comes, just before saving a new row Akelos checks the uniqueness of the 'datum' field thinking it's a datetime field.

    From the $this-> meterreadingdate->dbug() :

    SELECT * FROM meterreadingdates WHERE meterreadingdates.datum = '2008-02-03 00:00:00' LIMIT 1
    

    .. because of the ' 00:00:00' bit an already existing record is not found. (at least not using MySQL)

    Changing the column type from date to datetime solves the problem of course.

    • CommentAuthorKaste
     

    I think we can call this a bug. do you have a test? ->TRAC

    • CommentAuthorThijs
     

    Okay, I'll make a test and make a ticket in the Trac (somewhere next month though)

    • CommentAuthorKaste
     

    now ticket #124