DEV: support running plugin without db

DEV: support running plugin without db

This is required for asset precompile

diff --git a/plugin.rb b/plugin.rb
index 3000b04..c57d2cc 100644
--- a/plugin.rb
+++ b/plugin.rb
@@ -25,8 +25,10 @@ after_initialize do
     '../app/serializers/concerns/topic_answer_mixin.rb'
   ].each { |path| load File.expand_path(path, __FILE__) }
 
+  skip_db = defined?(GlobalSetting.skip_db?) && GlobalSetting.skip_db?
+
   # we got to do a one time upgrade
-  if defined?(UserAction::SOLVED)
+  if !skip_db && defined?(UserAction::SOLVED)
     unless $redis.get('solved_already_upgraded')
       unless UserAction.where(action_type: UserAction::SOLVED).exists?
         Rails.logger.info("Upgrading storage for solved")

GitHub sha: 0fa0e7fd

1 Like