DEV: support running plugin without db

This is required for asset precompile
This commit is contained in:
Sam Saffron 2019-06-13 16:33:03 +10:00
parent f76244e3ba
commit 0fa0e7fd53
1 changed files with 3 additions and 1 deletions

View File

@ -25,8 +25,10 @@ after_initialize do
'../app/serializers/concerns/topic_answer_mixin.rb' '../app/serializers/concerns/topic_answer_mixin.rb'
].each { |path| load File.expand_path(path, __FILE__) } ].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 # 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 $redis.get('solved_already_upgraded')
unless UserAction.where(action_type: UserAction::SOLVED).exists? unless UserAction.where(action_type: UserAction::SOLVED).exists?
Rails.logger.info("Upgrading storage for solved") Rails.logger.info("Upgrading storage for solved")