diff --git a/db/data/20250226192005_activate_selfhosted_users.rb b/db/data/20250226192005_activate_selfhosted_users.rb new file mode 100644 index 00000000..ffb00583 --- /dev/null +++ b/db/data/20250226192005_activate_selfhosted_users.rb @@ -0,0 +1,15 @@ +# frozen_string_literal: true + +class ActivateSelfhostedUsers < ActiveRecord::Migration[8.0] + def up + return unless DawarichSettings.self_hosted? + + User.update_all(status: :active) # rubocop:disable Rails/SkipsModelValidations + end + + def down + return unless DawarichSettings.self_hosted? + + User.update_all(status: :inactive) # rubocop:disable Rails/SkipsModelValidations + end +end