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

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

51 lines
1.4 KiB
Ruby
Raw Normal View History

2020-07-28 23:09:34 +05:30
# frozen_string_literal: true
2022-10-11 01:57:18 +05:30
Gitlab::Database::Partitioning.register_models(
[
AuditEvent,
WebHookLog,
LooseForeignKeys::DeletedRecord,
2023-05-27 22:25:52 +05:30
Gitlab::Database::BackgroundMigration::BatchedJobTransitionLog,
2023-06-20 00:43:36 +05:30
Ci::RunnerManagerBuild
2022-10-11 01:57:18 +05:30
])
2021-09-30 23:02:18 +05:30
if Gitlab.ee?
2022-10-11 01:57:18 +05:30
Gitlab::Database::Partitioning.register_models(
[
IncidentManagement::PendingEscalations::Alert,
IncidentManagement::PendingEscalations::Issue,
2023-07-09 08:55:56 +05:30
Security::Finding,
Analytics::ValueStreamDashboard::Count
2022-10-11 01:57:18 +05:30
])
2021-12-11 22:18:48 +05:30
else
2022-10-11 01:57:18 +05:30
Gitlab::Database::Partitioning.register_tables(
[
{
limit_connection_names: %i[main],
table_name: 'incident_management_pending_alert_escalations',
partitioned_column: :process_at, strategy: :monthly
},
{
limit_connection_names: %i[main],
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?
2022-10-11 01:57:18 +05:30
Gitlab::Database::Partitioning.register_tables(
[
# This should be synchronized with the following model:
# https://jihulab.com/gitlab-cn/gitlab/-/blob/main-jh/jh/app/models/phone/verification_code.rb
{
limit_connection_names: %i[main],
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