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

44 lines
1.3 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,
2022-04-04 11:22:00 +05:30
LooseForeignKeys::DeletedRecord,
Gitlab::Database::BackgroundMigration::BatchedJobTransitionLog
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([
{
2022-04-04 11:22:00 +05:30
limit_connection_names: %i[main],
2021-12-11 22:18:48 +05:30
table_name: 'incident_management_pending_alert_escalations',
partitioned_column: :process_at, strategy: :monthly
},
{
2022-04-04 11:22:00 +05:30
limit_connection_names: %i[main],
2021-12-11 22:18:48 +05:30
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:
2022-04-04 11:22:00 +05:30
# https://jihulab.com/gitlab-cn/gitlab/-/blob/main-jh/jh/app/models/phone/verification_code.rb
2021-12-11 22:18:48 +05:30
{
2022-04-04 11:22:00 +05:30
limit_connection_names: %i[main],
2021-12-11 22:18:48 +05:30
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