summaryrefslogtreecommitdiff
path: root/lib/gitlab/database/dynamic_model_helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/database/dynamic_model_helpers.rb')
-rw-r--r--lib/gitlab/database/dynamic_model_helpers.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/gitlab/database/dynamic_model_helpers.rb b/lib/gitlab/database/dynamic_model_helpers.rb
new file mode 100644
index 00000000000..892f8291780
--- /dev/null
+++ b/lib/gitlab/database/dynamic_model_helpers.rb
@@ -0,0 +1,16 @@
+# frozen_string_literal: true
+
+module Gitlab
+ module Database
+ module DynamicModelHelpers
+ def define_batchable_model(table_name)
+ Class.new(ActiveRecord::Base) do
+ include EachBatch
+
+ self.table_name = table_name
+ self.inheritance_column = :_type_disabled
+ end
+ end
+ end
+ end
+end