diff --git a/.gossamer_forums.rb.swo b/.gossamer_forums.rb.swo index 382f114..c6d534e 100644 Binary files a/.gossamer_forums.rb.swo and b/.gossamer_forums.rb.swo differ diff --git a/goss-destroydeletedposts.rb b/goss-destroydeletedposts.rb index b4c6d34..8e51717 100644 --- a/goss-destroydeletedposts.rb +++ b/goss-destroydeletedposts.rb @@ -1,7 +1,7 @@ # Federated Computer, Inc. # David Sainty 2024 A.D. # Gossamer Threads to Discourse -- CleanUp Script -# v0.1 New script +# v0.2 Fix class definition require 'mysql2' require 'active_record' @@ -9,6 +9,14 @@ require 'active_record' # require 'concurrent-ruby' require File.expand_path("../../../../config/environment", __FILE__) +class LegacyPost < ActiveRecord::Base + self.table_name = 'gforums_Post' +end + +class LegacyUser < ActiveRecord::Base + self.table_name = 'gforums_User' +end + class GossamerForumsDestroyDeletedPosts # def initialize # super @@ -53,11 +61,6 @@ class GossamerForumsDestroyDeletedPosts password: 'yxnh93Ybbz2Nm8#mp28zCVv' ) - # Load the gforums_Post model for legacy database - class LegacyPost < ActiveRecord::Base - self.table_name = 'gforums_Post' - end - # Find all posts marked as deleted in the legacy database LegacyPost.where(post_deleted: 1).find_each do |legacy_post| # Look for the post in Discourse by custom field @@ -81,15 +84,6 @@ class GossamerForumsDestroyDeletedPosts password: 'yxnh93Ybbz2Nm8#mp28zCVv' ) - # Load the gforums_Post model for legacy database - class LegacyPost < ActiveRecord::Base - self.table_name = 'gforums_Post' - end - - class LegacyUser < ActiveRecord::Base - self.table_name = 'gforums_User' - end - # Find the user ID for the given username user = LegacyUser.find_by(username: username) if user.nil?