v0.4 Go back to simpler use of MySQL2

This commit is contained in:
David Sainty 2024-09-09 14:52:35 +10:00
parent d60cdafbfe
commit 8ab138242a

View File

@ -47,7 +47,7 @@ class GossamerForumsDestroyDeletedPosts < ImportScripts::Base
def destroy_deleted_posts_from_gossamer_with_user(username)
# Query the user ID from the legacy MySQL database
user_result = @mysql_client.query("SELECT user_id FROM gforums_User WHERE user_username = '#{username}' LIMIT 1")
user_result = @mysql_client.query("SELECT user_id FROM gforum_User WHERE user_username = '#{username}' LIMIT 1")
user_id_row = user_result.first
if user_id_row.nil?
puts "DiscourseDeletedPosts: No user found with username: #{username}"
@ -56,7 +56,7 @@ class GossamerForumsDestroyDeletedPosts < ImportScripts::Base
user_id = user_id_row['user_id']
# Find all posts marked as deleted by the given user
posts_result = @mysql_client.query("SELECT post_id FROM gforums_Post WHERE post_deleted = 1 AND user_id_fk = #{user_id}")
posts_result = @mysql_client.query("SELECT post_id FROM gforum_Post WHERE post_deleted = 1 AND user_id_fk = #{user_id}")
posts_result.each do |legacy_post|
post_id = legacy_post['post_id']