summaryrefslogtreecommitdiff
path: root/config/initializers/postgres_partitioning.rb
diff options
context:
space:
mode:
Diffstat (limited to 'config/initializers/postgres_partitioning.rb')
-rw-r--r--config/initializers/postgres_partitioning.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/config/initializers/postgres_partitioning.rb b/config/initializers/postgres_partitioning.rb
new file mode 100644
index 00000000000..6c8a72d9bd5
--- /dev/null
+++ b/config/initializers/postgres_partitioning.rb
@@ -0,0 +1,10 @@
+# frozen_string_literal: true
+
+# Make sure we have loaded partitioned models here
+# (even with eager loading disabled).
+
+begin
+ Gitlab::Database::Partitioning::PartitionCreator.new.create_partitions
+rescue ActiveRecord::ActiveRecordError, PG::Error
+ # ignore - happens when Rake tasks yet have to create a database, e.g. for testing
+end