Support Forum

Upgraded test site and got Table '_sfforums' doesn't exist

CM Chris Moody
Chris Moody
Member

Hi,

 

Before I update the life site I did a test site but I can not create new forums anymore

and get this message

../public_html/wp-content/plugins/simple-press/admin/panel-forums/forms/spa-forums-global-rss-form.php
line: 40
function: spdb_count
error: Table ‘_sfforums’ doesn’t exist

SELECT COUNT(*) FROM _sfforums WHERE forum_rss_private=1

I’ve tried deleting everything and did a fresh install but something is not right here 🙂

Please advise

 

Regards,

13 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

Somebody else had a problem with this table recently but I have had no update on the state of the problem or if it is resolved. And it is very strange indeed. The first thing I can assure you of is that there have been no database updates since version 5.7.2 which is quite a while back so nothing in the upgrade procedure should have any bearing on this.

Let me say to you what I said to the other user…

I can think of two possibilities.

The first – and the worse – is that the table has been deleted. The only person, I would think, who would know that is you and I assume you have not done this!

But the other possibility – and perhaps the more likely – is that it has become unavailable because it needs a repair and optimisation. The WordPress team never tells you this but mySQL databases really need some care and maintenance regularly to keep them in top condition. If left, then sooner or later one of the tables will crash and will require repairing. This can be averted by regular optimisation.

I would recommend a WP plugin such as ‘WP Optimize’ (https://wordpress.org/plugins/wp-optimize/) which can perform an optimisation on demand but can also be scheduled to run in the background at set intervals. This particular plugin also removed cruft from the database so you need to make sure you are happy for that to happen and if not there are alternative plugins available. As far as I know this plugin will perform repairs as well.

But, as this is a test site, then you can probably look at the database (i.e., using phpMyAdmin for example) to determine if the table IS still there…

YS Yellow Swordfish
Yellow Swordfish
Member

By the way – can I assume that when you quoted the error you purposefully removed the table prefix?

CM Chris Moody
Chris Moody
Member

Correct I did remove the prefix.

I’ve looked in the database but table is not in.

Do you have a script so I can create the tables ? After a repair with wp-optimize it is not working yet 😉

 

regards,

YS Yellow Swordfish
Yellow Swordfish
Member

I have added the script below although note you will need to (a) replace the ‘xxx’ with your table prefix and (b) change the engine if you are not using myISAM tables.

There is nothing in the upgrade script at all. All that happens during thje upgrade process is that the build and version numbers are updated in the sfoptions table. So I am afraid I have no idea what may have happened to your table…. Do you have any ideas?

Of course – the table creation can not replace any missing data. Note that I have included any new columns created by SP plugins as I am unsure what, if any, you may be using.

CREATE TABLE `xxx_sfforums` (
 `forum_id` bigint(20) NOT NULL AUTO_INCREMENT,
 `forum_name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
 `group_id` bigint(20) NOT NULL,
 `forum_seq` int(4) DEFAULT NULL,
 `forum_desc` mediumtext COLLATE utf8mb4_unicode_ci,
 `forum_status` int(4) NOT NULL DEFAULT '0',
 `forum_slug` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
 `forum_rss` mediumtext COLLATE utf8mb4_unicode_ci,
 `forum_icon` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `post_id` bigint(20) DEFAULT NULL,
 `topic_count` mediumint(8) DEFAULT '0',
 `forum_rss_private` smallint(1) NOT NULL DEFAULT '0',
 `topic_status_set` bigint(20) DEFAULT '0',
 `post_count` mediumint(8) DEFAULT '0',
 `post_ratings` smallint(1) NOT NULL DEFAULT '0',
 `use_tags` smallint(1) NOT NULL DEFAULT '1',
 `parent` bigint(20) NOT NULL DEFAULT '0',
 `children` mediumtext COLLATE utf8mb4_unicode_ci,
 `forum_message` mediumtext COLLATE utf8mb4_unicode_ci,
 `in_sitemap` smallint(1) NOT NULL DEFAULT '1',
 `post_id_held` bigint(20) DEFAULT NULL,
 `post_count_held` mediumint(8) DEFAULT '0',
 `forum_icon_new` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `topic_icon` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `topic_icon_new` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `forum_email` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `polls` smallint(1) NOT NULL DEFAULT '0',
 `keywords` varchar(256) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `forum_disabled` smallint(1) NOT NULL DEFAULT '0',
 `topic_icon_locked` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `forum_icon_locked` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `topic_icon_pinned` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `feature_image` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `last_topic_id` bigint(20) NOT NULL DEFAULT '0',
 `topic_icon_pinned_new` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `permalink_slug` varchar(1000) COLLATE utf8mb4_unicode_ci NOT NULL,
 `forum_hide_posters` smallint(1) NOT NULL DEFAULT '0',
 PRIMARY KEY (`forum_id`),
 KEY `group_id_idx` (`group_id`),
 KEY `forum_slug_idx` (`forum_slug`),
 KEY `post_id_idx` (`post_id`),
 KEY `topic_status_set_idx` (`topic_status_set`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
YS Yellow Swordfish
Yellow Swordfish
Member

It would be nice to know what happened though….

CM Chris Moody
Chris Moody
Member

Hi,

I there are more errors like _sftopics does not exsist as well

ine: 464
function: spdb_table
error: Table ‘xxx_sftopics’ doesn’t exist

SELECT * FROM xxx_sftopics WHERE forum_id=2

Do you have a tool or script  to recreate all tables ?

And just like you said @yellow-swordfish it would be great to know why this is happening.

 

regards,

 

PS I have delete the whole plugin looked at the tables are were gone did a clean install but those tables were not created

YS Yellow Swordfish
Yellow Swordfish
Member

I wish I could think of an explanation for this quite unique experience. I have to say that if I were you I would be asking my host to look at the mySQL error log to see if they can determine what the problem is. For the record – all of our tables are created using the same structure and syntax so if some are successful it is hard to determine why some should not be. If there is some sort of mySQL problem it could affect other plugins you may want to install in the future.

I can give you a script for any missing table but I think it would be wise to check which ones are actually missing in case there are others. The worry os that some of them come pre-populated with data se we should just check if any fall into that category.

So – below is a complete list of the tables defined with a new install. Perhaps you could check them all and I can then construct a definitive SQL script for you.

sfgroups
sfforums
sftopics
sfposts
sftrack
sfusergroups
sfpermissions
sfdefpermissions
sfroles
sfmembers
sfmemberships
sfmeta
sflog
sflogmeta
sfoptions
sferrorlog
sfauths
sfauthcats
sfwaiting
sfnotices
sfspecialranks
sfuseractivitytype
sfuseractivity
sfcache
sfadminkeywords
sfadmintasks

CM Chris Moody
Chris Moody
Member

Hi,

This is a list with the sf tables I have after a clean install.

Ooh I have added the forum with the script above.

 

Regards,

list-sf-tables.PNG
YS Yellow Swordfish
Yellow Swordfish
Member

It’s just the topics table that is missing there. I included the able sfuseractivitytype in my list but realised that this is a 5.8 upgrade table so you wont have that at all yet anyway.

I will create a sql script as above for the sftopics table. Give me a few minutes…

YS Yellow Swordfish
Yellow Swordfish
Member

OK – sftopics. Again you will need to change the tabke prefix from xxx_ to your own.

CREATE TABLE `xxx_sftopics` (
 `topic_id` bigint(20) NOT NULL AUTO_INCREMENT,
 `topic_name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
 `topic_date` datetime NOT NULL,
 `topic_status` int(4) NOT NULL DEFAULT '0',
 `forum_id` bigint(20) NOT NULL,
 `user_id` bigint(20) unsigned DEFAULT NULL,
 `topic_pinned` smallint(1) NOT NULL DEFAULT '0',
 `topic_opened` bigint(20) NOT NULL DEFAULT '0',
 `blog_post_id` bigint(20) NOT NULL DEFAULT '0',
 `topic_slug` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL,
 `post_id` bigint(20) DEFAULT NULL,
 `post_count` mediumint(8) DEFAULT '0',
 `topic_status_flag` varchar(25) COLLATE utf8mb4_unicode_ci DEFAULT NULL,
 `post_id_held` bigint(20) DEFAULT NULL,
 `post_count_held` mediumint(8) DEFAULT '0',
 `answered` bigint(20) NOT NULL DEFAULT '0',
 `expire_date` datetime DEFAULT NULL,
 `expire_action` int(4) NOT NULL DEFAULT '0',
 PRIMARY KEY (`topic_id`),
 KEY `forum_id_idx` (`forum_id`),
 KEY `topic_slug_idx` (`topic_slug`),
 KEY `user_id_idx` (`user_id`),
 KEY `post_id_idx` (`post_id`),
 KEY `topic_status_flag_idx` (`topic_status_flag`),
 KEY `expire_date_idx` (`expire_date`)
) ENGINE=MyISAM AUTO_INCREMENT=22840 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

I have included a few columns that are usually added with SP plugins (same with the other one earlier) but that’s OK.

CM Chris Moody
Chris Moody
Member

Ok seems to work again 😉

 

thank you for your time

regards

 

PS do you know what it could be  ??

YS Yellow Swordfish
Yellow Swordfish
Member

No – as I said on the post earlier, I have no idea what ion earth could cause that. But as I also said, I would urge you to talk to your host and look at the mysql error log.