summaryrefslogtreecommitdiff
path: root/config/initializers/postgres_partitioning.rb
blob: f2e2fba1559c695c304f678cb67153083f4541e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# frozen_string_literal: true

Gitlab::Database::Partitioning.register_models([
  AuditEvent,
  WebHookLog,
  LooseForeignKeys::DeletedRecord
])

if Gitlab.ee?
  Gitlab::Database::Partitioning.register_models([
    IncidentManagement::PendingEscalations::Alert,
    IncidentManagement::PendingEscalations::Issue
  ])
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
end