From 7d296b3ceabc2a02833d94e7633730417f5196f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arpad=20M=C3=BCller?= Date: Wed, 15 Jan 2025 02:00:49 +0100 Subject: [PATCH] Add schema for timelines table --- .../2025-01-15-000118_safekeeper_timelines/down.sql | 1 + .../2025-01-15-000118_safekeeper_timelines/up.sql | 10 ++++++++++ storage_controller/src/schema.rs | 13 +++++++++++++ 3 files changed, 24 insertions(+) create mode 100644 storage_controller/migrations/2025-01-15-000118_safekeeper_timelines/down.sql create mode 100644 storage_controller/migrations/2025-01-15-000118_safekeeper_timelines/up.sql diff --git a/storage_controller/migrations/2025-01-15-000118_safekeeper_timelines/down.sql b/storage_controller/migrations/2025-01-15-000118_safekeeper_timelines/down.sql new file mode 100644 index 0000000000..59b343b467 --- /dev/null +++ b/storage_controller/migrations/2025-01-15-000118_safekeeper_timelines/down.sql @@ -0,0 +1 @@ +DROP TABLE timelines; diff --git a/storage_controller/migrations/2025-01-15-000118_safekeeper_timelines/up.sql b/storage_controller/migrations/2025-01-15-000118_safekeeper_timelines/up.sql new file mode 100644 index 0000000000..18daa5e987 --- /dev/null +++ b/storage_controller/migrations/2025-01-15-000118_safekeeper_timelines/up.sql @@ -0,0 +1,10 @@ +CREATE TABLE timelines ( + tenant_id VARCHAR NOT NULL, + timeline_id VARCHAR NOT NULL, + PRIMARY KEY(tenant_id, timeline_id), + generation INTEGER NOT NULL, + sk_set BIGINT[] NOT NULL, + new_sk_set BIGINT[] NOT NULL, + cplane_notified_generation INTEGER NOT NULL, + status VARCHAR NOT NULL +); diff --git a/storage_controller/src/schema.rs b/storage_controller/src/schema.rs index 14c30c296d..8b6320aff1 100644 --- a/storage_controller/src/schema.rs +++ b/storage_controller/src/schema.rs @@ -58,10 +58,23 @@ diesel::table! { } } +diesel::table! { + timelines (tenant_id, timeline_id) { + tenant_id -> Varchar, + timeline_id -> Varchar, + generation -> Int4, + sk_set -> Array>, + new_sk_set -> Array>, + cplane_notified_generation -> Int4, + status -> Varchar, + } +} + diesel::allow_tables_to_appear_in_same_query!( controllers, metadata_health, nodes, safekeepers, tenant_shards, + timelines, );