blob: dc2a3a15239ee78851d0a7316fd3f200fd7a2e37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# frozen_string_literal: true
class AddPartitionedVsdCountsTable < Gitlab::Database::Migration[2.1]
include Gitlab::Database::PartitioningMigrationHelpers
def up
execute(<<~SQL)
CREATE TABLE value_stream_dashboard_counts (
id bigserial NOT NULL,
namespace_id bigint NOT NULL,
count bigint NOT NULL,
recorded_at timestamp with time zone NOT NULL,
metric smallint NOT NULL,
PRIMARY KEY (namespace_id, metric, recorded_at, count, id)
) PARTITION BY RANGE (recorded_at);
SQL
min_date = Date.today
max_date = Date.today + 6.months
create_daterange_partitions('value_stream_dashboard_counts', 'recorded_at', min_date, max_date)
end
def down
drop_table :value_stream_dashboard_counts
end
end
|