I recently moved my forum to a new server. And now I'm getting the following error when posting.
Field 'spam' doesn't have a default value
File: /var/www/rhemuthcastle.com/Sources/Subs-Post.php
Line: 1856
Note: It appears that your database may require an upgrade. Your forum's files are currently at version SMF 2.0.15, while your database is at version 2.0.4. The above error might possibly go away if you execute the latest version of upgrade.php.
Not sure how my database would be out of date it doesn't show up on any version check I've done.
The error is from an anti-spam mod. You may be able to fix it if you assign "null" value to the field in your database. The database version error is usually considered bogus, but there was a minor database change around 2.0.6. If you're running 2.0.4, you should upgrade to 2.0.15 in package manager.
I attempted to run an upgrade but it didn't work for some reason. I am not sure why. Also I have attempted the clean install by removing the Sources and Themes directories and replacing them. And when attempted to run the fix_packages.php I just get a blank screen.
This is becoming very frustrating to myself and the users of the forum as well. I'm tempted to do a full install without all the walk through of the multiple upgrades that have happened over the past 10+ years I've ran the SMF forum and start completely fresh. But then how do I preserve all of that precious data?
Lainaus käyttäjältä: bynw - joulukuu 01, 2019, 11:02:03 IP
I attempted to run an upgrade but it didn't work for some reason.
Were you trying to upgrade one step at a time in package manager? Errors?
Lainaa
Also I have attempted the clean install by removing the Sources and Themes directories and replacing them.
Broke all your mods. :P
Best thing to do at this point is upload a clean set of files and reinstall your mods. Content shouldn't be affected unless you've also been dicking around with your database.
really... you were told how to fix the issue.
Just go into your phpmyadmin and give the column in the database a default value of NULL.
So now... hopefully you have a backup, before you deleted anything.
Restore that.
then give the database column a value - and the error will go away.
I haven't deleted anything at all from the database. It has been left in tact. Only the files in Sources/ and Themes/ while attempting to fix the issues before posting here when they did not work.
Now, looking into the database there is no table for spam or sub-post that I can find. At least nothing labeled as such. So which column is supposed to be set to NULL?
It's likely in the topics or messages table.
you deleted files.
You did not need to delete files.
Deleting files will have made things much much worse.
Restore the files to the ones that were there before you deleted them.
I said nothing about a TABLE... you have to find what table the column was added into as part of the mod... and then set the default for that column.
After you have restored the previous versions of the files, you can look in Subs-Post.php to check what table the mod is using for the spam column
Or you can run a db query to find it -
SELECT table_name,table_schema
FROM INFORMATION_SCHEMA.COLUMNS
WHERE column_name='spam'
Lainaus käyttäjältä: Arantor - joulukuu 02, 2019, 09:18:05 AP
It's likely in the topics or messages table.
Thanks @Arantor. It was in the Topics table. I did find it there and was able to set it's default to NULL and that error has gone away.