2020-07-15 00:09:23 +00:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Make sure we have loaded partitioned models here
|
|
|
|
# (even with eager loading disabled).
|
|
|
|
|
2021-07-13 15:08:38 +00:00
|
|
|
Gitlab::Database::Partitioning::PartitionManager.register(AuditEvent)
|
|
|
|
Gitlab::Database::Partitioning::PartitionManager.register(WebHookLog)
|
2021-09-16 15:12:47 +00:00
|
|
|
Gitlab::Database::Partitioning::PartitionManager.register(LooseForeignKeys::DeletedRecord)
|
2020-07-22 21:09:50 +00:00
|
|
|
|
2021-06-30 21:07:26 +00:00
|
|
|
if Gitlab.ee?
|
2021-07-13 15:08:38 +00:00
|
|
|
Gitlab::Database::Partitioning::PartitionManager.register(IncidentManagement::PendingEscalations::Alert)
|
2021-08-27 00:08:45 +00:00
|
|
|
Gitlab::Database::Partitioning::PartitionManager.register(IncidentManagement::PendingEscalations::Issue)
|
2021-06-30 21:07:26 +00:00
|
|
|
end
|
|
|
|
|
2020-07-15 00:09:23 +00:00
|
|
|
begin
|
2021-07-13 15:08:38 +00:00
|
|
|
Gitlab::Database::Partitioning::PartitionManager.new.sync_partitions unless ENV['DISABLE_POSTGRES_PARTITION_CREATION_ON_STARTUP']
|
2020-07-15 00:09:23 +00:00
|
|
|
rescue ActiveRecord::ActiveRecordError, PG::Error
|
|
|
|
# ignore - happens when Rake tasks yet have to create a database, e.g. for testing
|
|
|
|
end
|