XF 1.4 Delete all threads,category and reset Id.

Can i use this SQL ??
I don't want to delete users! :(
Code:
DELETE FROM xf_user_group WHERE user_group_id >= 5;
DELETE FROM xf_user WHERE user_id != 1;
DELETE FROM xf_admin WHERE user_id != 1;
ALTER TABLE xf_user_group
AUTO_INCREMENT = 5;
ALTER TABLE xf_user
AUTO_INCREMENT = 2;
TRUNCATE TABLE xf_thread;
ALTER TABLE xf_thread
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_post;
ALTER TABLE xf_post
AUTO_INCREMENT = 1;
DELETE FROM xf_user_authenticate WHERE user_id != 1;
TRUNCATE TABLE xf_user_group_relation;
TRUNCATE TABLE xf_user_ban;
TRUNCATE TABLE xf_user_external_auth;
TRUNCATE TABLE xf_user_alert;
TRUNCATE TABLE xf_user_follow;
TRUNCATE TABLE xf_user_news_feed_cache;

DELETE FROM xf_user_option WHERE user_id > 1;
DELETE FROM xf_user_privacy WHERE user_id > 1;
DELETE FROM xf_user_profile WHERE user_id > 1;
TRUNCATE TABLE xf_user_status;
TRUNCATE TABLE xf_user_trophy;
TRUNCATE TABLE xf_admin_log;
ALTER TABLE xf_admin_log
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_conversation_master;
ALTER TABLE xf_conversation_master
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_conversation_message;
ALTER TABLE xf_conversation_message
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_conversation_recipient;
TRUNCATE TABLE xf_conversation_user;
TRUNCATE TABLE xf_error_log;
TRUNCATE TABLE xf_forum;
ALTER TABLE xf_forum
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_forum_prefix;
TRUNCATE TABLE xf_link_forum;
TRUNCATE TABLE xf_import_log;
TRUNCATE TABLE xf_ip;
ALTER TABLE xf_ip
AUTO_INCREMENT = 2;
TRUNCATE TABLE xf_liked_content;
ALTER TABLE xf_liked_content
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_moderation_queue;
TRUNCATE TABLE xf_moderator;
TRUNCATE TABLE xf_moderator_content;
ALTER TABLE xf_moderator_content
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_node;
ALTER TABLE xf_node
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_poll;
ALTER TABLE xf_poll
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_poll_response;
ALTER TABLE xf_poll_response
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_poll_vote;
TRUNCATE TABLE xf_profile_post;
ALTER TABLE xf_profile_post
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_search;
TRUNCATE TABLE xf_search_index;
TRUNCATE TABLE xf_session;
TRUNCATE TABLE xf_session_activity;
TRUNCATE TABLE xf_thread_user_post;
TRUNCATE TABLE xf_thread_watch;
TRUNCATE TABLE xf_thread_read;
TRUNCATE TABLE xf_permission_cache_content;
TRUNCATE TABLE xf_permission_group;
TRUNCATE TABLE xf_warning;
ALTER TABLE xf_warning
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_moderator_log;
ALTER TABLE xf_moderator_log
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_forum_watch;
TRUNCATE TABLE xf_forum_read;
TRUNCATE TABLE xf_report;
TRUNCATE TABLE xf_report_comment;
ALTER TABLE xf_report
AUTO_INCREMENT = 1;
ALTER TABLE xf_report_comment
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_stats_daily;
TRUNCATE TABLE xf_user_confirmation;
ALTER TABLE xf_thread_read
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_attachment;
TRUNCATE TABLE xf_attachment_data;
TRUNCATE TABLE xf_attachment_view;
ALTER TABLE xf_attachment
AUTO_INCREMENT = 1;
ALTER TABLE xf_attachment_data
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_user_field_value;
TRUNCATE TABLE xf_user_field;
TRUNCATE TABLE xf_thread_prefix;
ALTER TABLE xf_thread_prefix
AUTO_INCREMENT = 1;
TRUNCATE TABLE xf_thread_prefix_group;
ALTER TABLE xf_thread_prefix_group
AUTO_INCREMENT = 1;
 
Manually manipulating the database is never a good idea - there is a lot of interconnected data and tables.

Deleting content should be done via the regular UI (that won't reset IDs though).
 
So is that a good idea to do a clean installation and then import user tables?

Maybe I'll live with those IDs or find a way to remove IDs from urls completely
 
If you want to retain some content (e.g users) then an XF to XF import would probably be the best option.

Delete the content you no longer want from the source forum, then run the import and just import the users.
 
Back
Top Bottom