Error when update add-on

Toulimes

New member
Hi !
I've this error when I try to update my addon :

Mysqli prepare error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'UNSIGNED NOT NULL, `title` VARCHAR(50) UNSIGNED NOT NULL, `date` INT(10)' at line 3

  1. Zend_Db_Statement_Mysqli->_prepare() in Zend/Db/Statement.php at line 115
  2. Zend_Db_Statement->__construct() in Zend/Db/Adapter/Mysqli.php at line 381
  3. Zend_Db_Adapter_Mysqli->prepare() in Zend/Db/Adapter/Abstract.php at line 478
  4. Zend_Db_Adapter_Abstract->query() in Add/Install.php at line 18
  5. News_Install::install()
  6. call_user_func() in XenForo/Model/AddOn.php at line 215
  7. XenForo_Model_AddOn->installAddOnXml() in XenForo/Model/AddOn.php at line 169
  8. XenForo_Model_AddOn->installAddOnXmlFromFile() in XenForo/ControllerAdmin/AddOn.php at line 236
  9. XenForo_ControllerAdmin_AddOn->actionUpgrade() in XenForo/FrontController.php at line 347
  10. XenForo_FrontController->dispatch() in XenForo/FrontController.php at line 134
  11. XenForo_FrontController->run() in /home/u354649613/public_html/admin.php at line 13

Here is my Install file :
PHP:
<?php

class Add_Install
{
    public static function install()
    {
       $db = XenForo_Application::get('db');
      
        $db->query( "
            CREATE TABLE IF NOT EXISTS `xf_add` (
                `id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
                `creator` VARCHAR(50) UNSIGNED NOT NULL,
                `title` VARCHAR(50) UNSIGNED NOT NULL,
                `date` INT(10) UNSIGNED NOT NULL,
                `message` TEXT NOT NULL,
                PRIMARY KEY (`id`)
            )
        ");
    }
    public static function uninstall()
    {
       $db = XenForo_Application::get('db');
      
        $db->query("DROP TABLE IF EXISTS `xf_add`;");
    }
}

Can you help me please ?
 
Try this:
PHP:
<?php

class Add_Install
{
    public static function install()
    {
       $db = XenForo_Application::get('db');
    
        $db->query("
            CREATE TABLE IF NOT EXISTS xf_add (
                id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
                creator VARCHAR(50) NOT NULL,
                title VARCHAR(50) NOT NULL,
                date INT(10) UNSIGNED NOT NULL,
                message TEXT NOT NULL,
                PRIMARY KEY (id)
            )
        ");
    }
    public static function uninstall()
    {
       $db = XenForo_Application::get('db');
    
        $db->query("DROP TABLE IF EXISTS `xf_add`;");
    }
}
 
Back
Top Bottom