v0.2 Fix class definition for goss-destroydeletedposts.rb
This commit is contained in:
parent
145e956011
commit
b61b2edbaa
Binary file not shown.
@ -1,7 +1,7 @@
|
||||
# Federated Computer, Inc.
|
||||
# David Sainty <saint@federated.computer> 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?
|
||||
|
Loading…
Reference in New Issue
Block a user