1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

XF 1.5 Field 'draft_id' doesn't have a default value.

Discussion in 'Troubleshooting and Problems' started by Zesix, Nov 15, 2015.

  1. Zesix

    Zesix New Member

    Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Field 'draft_id' doesn't have a default value - library\Zend\Db\Statement\Mysqli.php:214

    Do you know what might cause this and how to fix it?
     
  2. Brogan

    Brogan XenForo Moderator Staff Member

    Can you post the full stack trace?

    That could be from an add-on, one which is currently disabled.
     
  3. Zesix

    Zesix New Member

    #0 D:\home\site\wwwroot\library\Zend\Db\Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
    #1 D:\home\site\wwwroot\library\Zend\Db\Adapter\Abstract.php(479): Zend_Db_Statement->execute(Array)
    #2 D:\home\site\wwwroot\library\XenForo\Model\Draft.php(47): Zend_Db_Adapter_Abstract->query('\r\n\t\t\tINSERT INT...', Array)
    #3 D:\home\site\wwwroot\library\XenForo\ControllerPublic\Thread.php(746): XenForo_Model_Draft->saveDraft('thread-1013', 'A few effects t...', Array)
    #4 D:\home\site\wwwroot\library\XenForo\FrontController.php(351): XenForo_ControllerPublic_Thread->actionSaveDraft()
    #5 D:\home\site\wwwroot\library\XenForo\FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
    #6 D:\home\site\wwwroot\index.php(13): XenForo_FrontController->run()
    #7 {main}
     
  4. Robust

    Robust Well-Known Member

    When does this error occur?
     
  5. Chris D

    Chris D XenForo Developer Staff Member

    Did you ever have an add-on or currently have one installed that was related to drafts in any way?

    The error should be impossible because the draft_id field should be set to AUTO_INCREMENT. Have you made any changes at all to MySQL?

    Are you able to run these queries and let us know the result?

    Code:
    SHOW CREATE TABLE xf_draft;
    Code:
    SELECT * FROM xf_draft WHERE draft_key = 'thread-1013';
    Does this always happen when saving a draft post in a thread?
     
  6. Zesix

    Zesix New Member

    I'm not sure, but the server error log has it showing up constantly. I imagine when someone posts a thread or edits a thread it occurs.

    The only add-on we have is the resource manager, but we're not actively using it so I doubt it is related to the problem.

    I will try the queries you posted and get back to you.
     
    Chris D likes this.
  7. Robust

    Robust Well-Known Member

    I see. It's usually helpful to know how to reproduce it, but really as Chris said, draft_id is an auto increment primary key. It's just meant to increment. This error would really mean a draft is being saved and the column 'draft_id' is no longer an auto increment one (blame an add-on for it, or something going wrong when creating/importing the table).
     

Share This Page