2020-07-14 20:09:23 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
# Make sure we have loaded partitioned models here
|
|
|
|
# (even with eager loading disabled).
|
|
|
|
|
2020-12-21 07:10:22 -05:00
|
|
|
Gitlab::Database::Partitioning::PartitionCreator.register(AuditEvent)
|
2020-07-22 17:09:50 -04:00
|
|
|
|
2020-07-14 20:09:23 -04:00
|
|
|
begin
|
2020-07-22 17:09:50 -04:00
|
|
|
Gitlab::Database::Partitioning::PartitionCreator.new.create_partitions unless ENV['DISABLE_POSTGRES_PARTITION_CREATION_ON_STARTUP']
|
2020-07-14 20:09:23 -04:00
|
|
|
rescue ActiveRecord::ActiveRecordError, PG::Error
|
|
|
|
# ignore - happens when Rake tasks yet have to create a database, e.g. for testing
|
|
|
|
end
|