Skip to content
Snippets Groups Projects
Verified Commit 054c6e81 authored by Marius Bobin's avatar Marius Bobin :two:
Browse files

Create partitions for p_ci_build_trace_metadata

Changelog: other
parent 2fb607d2
No related branches found
No related tags found
2 merge requests!170053Security patch upgrade alert: Only expose to admins 17-4,!168365Create partitions for p_ci_build_trace_metadata
# frozen_string_literal: true
class CreatePartitionsForPCiBuildTraceMetadata < Gitlab::Database::Migration[2.2]
milestone '17.5'
def up
return if already_partitioned?
execute(<<~SQL)
CREATE TABLE IF NOT EXISTS "gitlab_partitions_dynamic"."ci_build_trace_metadata_100"
PARTITION OF "p_ci_build_trace_metadata" FOR VALUES IN (100);
CREATE TABLE IF NOT EXISTS "gitlab_partitions_dynamic"."ci_build_trace_metadata_101"
PARTITION OF "p_ci_build_trace_metadata" FOR VALUES IN (101);
CREATE TABLE IF NOT EXISTS "gitlab_partitions_dynamic"."ci_build_trace_metadata_102"
PARTITION OF "p_ci_build_trace_metadata" FOR VALUES IN (102);
SQL
end
def down; end
private
def already_partitioned?
::Gitlab::Database::PostgresPartition
.for_parent_table(:p_ci_build_trace_metadata)
.partition_exists?(:ci_build_trace_metadata)
end
end
1d6d26d8ba7ad23cc2064bda8124f09bc5ad87cc48ad40a3e917b4634e80f782
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment