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,
|
|
|
|
Gitlab::Database::BackgroundMigration::BatchedJobTransitionLog
|
|
|
|
])
|
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,
|
|
|
|
Security::Finding
|
|
|
|
])
|
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
|