# Not a bug'nf_discord_enable' doesn't have a default value if i create a node

Affected version
v2.0.0

#### Tealk

##### Active member
Hallo,

I have create a copy from my Forum and have upgraded to xf2 but if i try to creat a node i get this error:

Code:
``````XF\Db\Exception: MySQL query error [1364]: Field 'nf_discord_enable' doesn't have a default value src/XF/Db/AbstractStatement.php:212
Generated by: Tealk Nov 29, 2017 at 2:21 PM
Stack trace
INSERT  INTO xf_forum (`node_id`, `allow_posting`, `allow_poll`, `moderate_threads`, `moderate_replies`, `count_messages`, `find_new`, `allowed_watch_notifications`, `default_sort_order`, `default_sort_direction`, `list_date_limit_days`, `default_prefix_id`, `require_prefix`, `min_tags`, `discussion_count`, `message_count`, `last_post_id`, `last_post_date`, `last_post_user_id`, `last_post_username`, `last_thread_title`, `last_thread_prefix_id`, `field_cache`, `prefix_cache`, `prompt_cache`) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
------------

#0 src/XF/Db/Mysqli/Statement.php(174): XF\Db\AbstractStatement->getException('MySQL query err...', 1364, 'HY000')
#1 src/XF/Db/Mysqli/Statement.php(69): XF\Db\Mysqli\Statement->getException('MySQL query err...', 1364, 'HY000')
#5 src/XF/Mvc/Entity/Entity.php(1113): XF\Mvc\Entity\Entity->_saveToSource()
#6 src/XF/Mvc/Entity/Entity.php(1131): XF\Mvc\Entity\Entity->save(true, false)
#7 src/XF/Mvc/FormAction.php(69): XF\Mvc\Entity\Entity->save(true, false)
#8 src/XF/Mvc/FormAction.php(159): XF\Mvc\FormAction->XF\Mvc\{closure}(Object(XF\Mvc\FormAction))
#11 src/XF/Mvc/Dispatcher.php(88): XF\Mvc\Dispatcher->dispatchClass('XF:Forum', 'Save', 'json', Object(XF\Mvc\ParameterBag), 'nodes', Object(XF\Admin\Controller\Forum), NULL)
#12 src/XF/Mvc/Dispatcher.php(41): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#13 src/XF/App.php(1879): XF\Mvc\Dispatcher->run()
#14 src/XF.php(328): XF\App->run()
#16 {main}
Request state
array(4) {
["_GET"] => array(1) {
["forums/0/save"] => string(0) ""
}
["_POST"] => array(12) {
["node"] => array(7) {
["title"] => string(7) "Support"
["description"] => string(0) ""
["node_name"] => string(0) ""
["parent_node_id"] => string(1) "0"
["display_order"] => string(4) "1000"
["display_in_list"] => string(1) "1"
}
["allow_posting"] => string(1) "1"
["min_tags"] => string(1) "0"
["default_sort_order"] => string(14) "last_post_date"
["default_sort_direction"] => string(4) "desc"
["list_date_limit_days"] => string(1) "0"
["default_prefix_id"] => string(2) "-1"
["_xfToken"] => string(8) "********"
["_xfWithData"] => string(1) "1"
["_xfResponseType"] => string(4) "json"
}
}``````

#### Mike

##### XenForo developer
Staff member
Specifically due to its (incorrect) schema declaration -- it would break whenever the add-on gets disabled. You may need to manually change/remove the column if the author can't tell you what change(s) are needed to it.

#### DragonByte Tech

##### Well-known member
Specifically due to its (incorrect) schema declaration
Just a wee note; maybe this would be useful to log in the developer docs, something to the effect of "if you are adding a column to a table that doesn't belong to your add-on, you must make sure the column has a default value to prevent errors if your add-on is disabled".

Only, y'know, written by someone who's not still trying to wake up

If I can find the dev docs github I'll log a feature request there. EDIT: Done - https://github.com/xenforo-ltd/docs/issues/29

Fillip

#### Tealk

##### Active member
Ok thanks for the information and good that it is a test installation

#### NixFifty

##### Well-known member
Oops, this is me. Will push a patch shortly.

#### NixFifty

##### Well-known member
@Tealk I took a look, running this sql query should do the trick:
SQL:
``ALTER TABLE `xf_forum` MODIFY COLUMN `nf_discord_enable` TINYINT(3) UNSIGNED NOT NULL DEFAULT '0';``
BURN THE WITCH!

Fillip
I deserve it.

Not sure how I missed it lol, the other column I add to that table has a default value. Must've been just waking up too.