Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions oximeter/db/schema/replicated/15/up.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
CREATE TABLE IF NOT EXISTS oximeter.measurements_cumulativef64_local_new_15 ON CLUSTER oximeter_cluster
(
timeseries_name String,
timeseries_key UInt64,
start_time DateTime64(9, 'UTC'),
timestamp DateTime64(9, 'UTC'),
datum Nullable(Float64)
)
ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/measurements_cumulativef64_local', '{replica}')
PARTITION BY (toYYYYMMDD(timestamp))
ORDER BY (timeseries_name, timeseries_key, start_time, timestamp)
TTL toDateTime(timestamp) + INTERVAL 30 DAY;

INSERT INTO oximeter.measurements_cumulativef64_local_new_15
SELECT * FROM oximeter.measurements_cumulativef64_local;

RENAME TABLE
oximeter.measurements_cumulativef64_local_new_15 to oximeter.measurements.cumulativef64_local,
oximeter.measurements_cumulativef64_local to oximeter.measurements.cumulativef64_local_old_15;

-- TODO: Drop the original table in a separate step, after verifying the migration.
-- DROP TABLE oximeter.measurements_cumulativef64_old_15;
1 change: 1 addition & 0 deletions oximeter/db/schema/replicated/db-init-1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ CREATE TABLE IF NOT EXISTS oximeter.measurements_cumulativef64_local ON CLUSTER
datum Nullable(Float64)
)
ENGINE = ReplicatedMergeTree('/clickhouse/tables/{shard}/measurements_cumulativef64_local', '{replica}')
PARTITION BY (toYYYYMMDD(timestamp))
ORDER BY (timeseries_name, timeseries_key, start_time, timestamp)
TTL toDateTime(timestamp) + INTERVAL 30 DAY;

Expand Down
Loading