News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Re: How to fix Field 'id' doesn't have a default value Database Error?

Started by Sudhakar Arjunan, March 03, 2023, 05:19:35 PM

Previous topic - Next topic

Sudhakar Arjunan

Quote from: Illori on March 16, 2015, 05:24:04 AMdid you use repair_settings.php or fix_packages.php to remove hooks? if you have not uninstall all your mods and use one of those files to remove the hooks and try again.

Tried using fix_packages.php, clicked remove hooks still I get this error in upgraded 2.1.3 with 0 mods in it now.

Database Error: Field 'description' doesn't have a default value
INSERT INTO smf_messages

Database Error: Field 'lastView' doesn't have a default value
REPLACE INTO sms_log_topics

Do you want me to delete Description column in smf_messages structure + lastView column in sms_log_topics
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

Kindred

Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Steve

I've split this off. Please don't respond to 8-year-old solved topics, even if your problem is similar to the original topic's.
DO NOT pm me for support!

Oldiesmann

There are two solutions to this:
1. Modify whatever query is causing that error and make it actually insert data into those columns (even if it's an empty string or a 0)
2. Modify the database structure and give those columns default values. Even if it's a TEXT column, it can have a default value as long as you're not running an ancient version of MySQL or MariaDB (MySQL has supported it since 8.0.13, which was released in October of 2018, and MariaDB since 10.2.1, which was released in July of 2016)
Michael Eshom
Christian Metal Fans

Sudhakar Arjunan

Quote from: Steve on March 04, 2023, 08:31:43 AMI've split this off. Please don't respond to 8-year-old solved topics, even if your problem is similar to the original topic's.
noted thank you.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

Sudhakar Arjunan

Quote from: Oldiesmann on March 05, 2023, 09:08:42 PMThere are two solutions to this:
1. Modify whatever query is causing that error and make it actually insert data into those columns (even if it's an empty string or a 0)
2. Modify the database structure and give those columns default values. Even if it's a TEXT column, it can have a default value as long as you're not running an ancient version of MySQL or MariaDB (MySQL has supported it since 8.0.13, which was released in October of 2018, and MariaDB since 10.2.1, which was released in July of 2016)

Thank you for the reply, but I don't not able to fix. Any assistance to fix please.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

Doug Heffernan

Quote from: Sudhakar Arjunan on March 15, 2023, 04:48:04 PMbut I don't not able to fix. Any assistance to fix please.

Did you try the aforementioned solution?

Quote from: Sudhakar Arjunan on March 03, 2023, 05:19:35 PMDatabase Error: Field 'description' doesn't have a default value
INSERT INTO smf_messages

Quote from: Sudhakar Arjunan on March 03, 2023, 05:19:35 PMDatabase Error: Field 'lastView' doesn't have a default value
REPLACE INTO sms_log_topics

Regarding your errors, both fields mentioned there are not part of default smf. They must have been added by custom mods. Do you still use those mods? If you do, follow the advice given above.

However, if you don't use those mods anymore, you can drop those custom fields from the database. No need to clutter the database with unused stuff left over from unused mods imo.

Sudhakar Arjunan

Quote from: Doug Heffernan on March 15, 2023, 05:27:54 PMRegarding your errors, both fields mentioned there are not part of default smf. They must have been added by custom mods. Do you still use those mods? If you do, follow the advice given above.

However, if you don't use those mods anymore, you can drop those custom fields from the database. No need to clutter the database with unused stuff left over from unused mods imo.

noted, will check for commands online to drop those fields.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum


Sudhakar Arjunan

Alter table work, issue resolved. Could able to post / reply now.
Thank you Dougeffernan.
Working on New Mods & Themes for SMF... Will update soon... My Blog page
My Smf forum : Discuss ITAcumens :: My SMF Forum

Steve

DO NOT pm me for support!

Doug Heffernan

Quote from: Sudhakar Arjunan on April 02, 2023, 12:57:47 AMAlter table work, issue resolved. Could able to post / reply now.
Thank you Dougeffernan.

You are welcome. :)

Advertisement: