Skip to content
代码片段 群组 项目
未验证 提交 bc8e272d 编辑于 作者: Adam Hegyi's avatar Adam Hegyi 提交者: GitLab
浏览文件

Merge branch 'pedropombeiro/470075/recreate-table' into 'master'

Recreate ci_finished_pipelines ClickHouse table

See merge request https://gitlab.com/gitlab-org/gitlab/-/merge_requests/158246



Merged-by: default avatarAdam Hegyi <ahegyi@gitlab.com>
Approved-by: default avatarAdam Hegyi <ahegyi@gitlab.com>
Reviewed-by: default avatarPedro Pombeiro <noreply@pedro.pombei.ro>
Co-authored-by: default avatarPedro Pombeiro <noreply@pedro.pombei.ro>
No related branches found
No related tags found
无相关合并请求
# frozen_string_literal: true
class RecreateCiFinishedPipelinesTable < ClickHouse::Migration
def up
execute <<~SQL
DROP TABLE IF EXISTS ci_finished_pipelines
SQL
execute <<~SQL
CREATE TABLE ci_finished_pipelines
(
`id` UInt64 DEFAULT 0,
`path` String DEFAULT '0/',
`committed_at` DateTime64(6, 'UTC') DEFAULT 0,
`created_at` DateTime64(6, 'UTC') DEFAULT 0,
`started_at` DateTime64(6, 'UTC') DEFAULT 0,
`finished_at` DateTime64(6, 'UTC') DEFAULT 0,
`duration` UInt64 DEFAULT 0,
`date` Date32 MATERIALIZED toStartOfMonth(finished_at),
`status` LowCardinality(String) DEFAULT '',
`source` LowCardinality(String) DEFAULT '',
`ref` String DEFAULT ''
)
ENGINE = ReplacingMergeTree
PARTITION BY toYear(finished_at)
ORDER BY (id)
SQL
end
def down
execute <<~SQL
DROP TABLE IF EXISTS ci_finished_pipelines
SQL
execute <<~SQL
CREATE TABLE ci_finished_pipelines
(
`id` UInt64 DEFAULT 0,
`project_id` UInt64 DEFAULT 0,
`committed_at` DateTime64(6, 'UTC') DEFAULT 0,
`created_at` DateTime64(6, 'UTC') DEFAULT 0,
`started_at` DateTime64(6, 'UTC') DEFAULT 0,
`finished_at` DateTime64(6, 'UTC') DEFAULT 0,
`duration` Int64,
`date` Date32 MATERIALIZED toStartOfMonth(finished_at),
`status` LowCardinality(String) DEFAULT '',
`source` LowCardinality(String) DEFAULT '',
`ref` String DEFAULT ''
)
ENGINE = ReplacingMergeTree
PARTITION BY toYear(finished_at)
ORDER BY (id)
SQL
end
end
0% 加载中 .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册