FIX: Avoid writing to DB on initialization.

FIX: Avoid writing to DB on initialization.

This was written a long time ago so we don’t have to carry the code around anymore.

diff --git a/plugin.rb b/plugin.rb
index 997bfc4..6330a1d 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -41,17 +41,6 @@ after_initialize do
   load File.expand_path("../app/controllers/discourse_cakeday/anniversaries_controller.rb", __FILE__)
   load File.expand_path("../app/controllers/discourse_cakeday/birthdays_controller.rb", __FILE__)
 
-  skip_db = defined?(GlobalSetting.skip_db?) && GlobalSetting.skip_db?
-
-  if !skip_db
-    begin
-      if OnceoffLog.where(job_name: 'MigrateDateOfBirthToUsersTable').exists?
-        UserCustomField.where(name: 'date_of_birth').delete_all
-      end
-    rescue ActiveRecord::StatementInvalid
-    end
-  end
-
   require_dependency 'user'
   class ::User
     scope :valid, ->() {

GitHub sha: 45923a8f

1 Like