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.rb27
1 files changed, 23 insertions, 4 deletions
diff --git a/config/initializers/postgres_partitioning.rb b/config/initializers/postgres_partitioning.rb
index 49f382547d6..5af8cf52656 100644
--- a/config/initializers/postgres_partitioning.rb
+++ b/config/initializers/postgres_partitioning.rb
@@ -10,10 +10,29 @@ if Gitlab.ee?
IncidentManagement::PendingEscalations::Alert,
IncidentManagement::PendingEscalations::Issue
])
+else
+ Gitlab::Database::Partitioning.register_tables([
+ {
+ table_name: 'incident_management_pending_alert_escalations',
+ partitioned_column: :process_at, strategy: :monthly
+ },
+ {
+ table_name: 'incident_management_pending_issue_escalations',
+ partitioned_column: :process_at, strategy: :monthly
+ }
+ ])
end
-begin
- Gitlab::Database::Partitioning.sync_partitions unless ENV['DISABLE_POSTGRES_PARTITION_CREATION_ON_STARTUP']
-rescue ActiveRecord::ActiveRecordError, PG::Error
- # ignore - happens when Rake tasks yet have to create a database, e.g. for testing
+# The following tables are already defined as models
+unless Gitlab.jh?
+ Gitlab::Database::Partitioning.register_tables([
+ # This should be synchronized with the following model:
+ # https://gitlab.com/gitlab-jh/gitlab/-/blob/main-jh/jh/app/models/phone/verification_code.rb
+ {
+ table_name: 'verification_codes',
+ partitioned_column: :created_at, strategy: :monthly
+ }
+ ])
end
+
+Gitlab::Database::Partitioning.sync_partitions_ignore_db_error