debian-mirror-gitlab/config/initializers/postgres_partitioning.rb

40 lines
1.1 KiB
Ruby
Raw Normal View History

2020-07-28 23:09:34 +05:30
# frozen_string_literal: true
2021-11-11 11:23:49 +05:30
Gitlab::Database::Partitioning.register_models([
AuditEvent,
2022-01-26 12:08:38 +05:30
WebHookLog,
LooseForeignKeys::DeletedRecord
2021-11-11 11:23:49 +05:30
])
2021-09-30 23:02:18 +05:30
if Gitlab.ee?
2021-11-11 11:23:49 +05:30
Gitlab::Database::Partitioning.register_models([
IncidentManagement::PendingEscalations::Alert,
IncidentManagement::PendingEscalations::Issue
])
2021-12-11 22:18:48 +05:30
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
}
])
2021-09-30 23:02:18 +05:30
end
2020-10-24 23:57:45 +05:30
2021-12-11 22:18:48 +05:30
# 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
}
])
2020-07-28 23:09:34 +05:30
end
2021-12-11 22:18:48 +05:30
Gitlab::Database::Partitioning.sync_partitions_ignore_db_error