News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Unable to add new post - database problem

Started by Grynio, March 19, 2021, 06:17:58 AM

Previous topic - Next topic

Grynio

Hi, I need help fixing the forum - it is currently not possible to add new messages due to an error message.

Everything worked fine until I had to change php to 7.4 on the server.
I had the forum updated to 2.0.18.

Then I got a bug in viewing some posts as admin:
[] operator not supported for strings administrator
although other (common) users had no problem displaying these posts correctly.

I found information that such an error may be caused by an old version of the database.
So I converted the database from MariaDB 10.1 to 10.5.

The posts were available for viewing again, but an error appeared when I tried to add a message:
Field 'karma_bad' doesn't have a default value
File: /home/grynko/ftp/forum/Sources/Subs-Post.php     <-- I attached the file to this post
Line: 1839

Note: It looks like your database needs updating. The forum files are currently at SMF 2.0.18 while the database is at 2.0.11. You should run the latest version of upgrade.php.


I used to have the karma log and karma actions mods installed, but they stopped working, so I uninstalled them (probably 4 years ago).

There is info about the upgrade in the error message, but when I try to do it again, I get the following message:
Database Changes
Executing database changes
Please be patient - this may take some time on large forums. The time elapsed increments from the server to show progress is being made!
Executing: "Changing column names." (1 of 43)

!!Error!
Unknown Error!


I did all the repairs and maintenance from the forum panel.

If you have ideas about what to do with it and how to fix it, I'll appreciate any help! :)

Aleksi "Lex" Kilpinen

The "Field 'karma_bad' doesn't have a default value" error is simple really, you just need to assign that field a default value in the database, usually if there is not one set already, NULL will do.
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Grynio

Quote from: Aleksi "Lex" Kilpinen on March 19, 2021, 08:06:57 AM
is simple really, you just need to assign that field a default value in the database, usually if there is not one set already, NULL will do.

But how noob can do this?

Aleksi "Lex" Kilpinen

Something like this should work
ALTER TABLE tablename ALTER columnname SET DEFAULT NULL;
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Sir Osis of Liver

Or just use phpmyadmin to edit the column structure.
Ashes and diamonds, foe and friend,
 we were all equal in the end.

                                     - R. Waters

Grynio

Thank you for answers, but I really need noob step by step instructions  :-[

Aleksi "Lex" Kilpinen

Do you have access to your database with a tool like PHPMyAdmin?
Slava
Ukraini!
"Before you allow people access to your forum, especially in an administrative position, you must be aware that that person can seriously damage your forum. Therefore, you should only allow people that you trust, implicitly, to have such access." -Douglas

How you can help SMF

Grynio

#7
Quote from: Aleksi "Lex" Kilpinen on March 21, 2021, 02:46:28 AM
Do you have access to your database with a tool like PHPMyAdmin?

I know how to do it by web app (attached).


EDIT: When I deleted both karma_ problem is solved!
Thanks for help :)

Advertisement: