diff --git a/quickwit/quickwit-metastore/migrations/postgresql/12_create-shards.down.sql b/quickwit/quickwit-metastore/migrations/postgresql/12_create-shards.down.sql new file mode 100644 index 00000000000..6ae7bfc8eb8 --- /dev/null +++ b/quickwit/quickwit-metastore/migrations/postgresql/12_create-shards.down.sql @@ -0,0 +1,3 @@ +DROP TABLE shards; + +DROP TYPE IF EXISTS SHARD_STATE; \ No newline at end of file diff --git a/quickwit/quickwit-metastore/migrations/postgresql/12_create-shards.up.sql b/quickwit/quickwit-metastore/migrations/postgresql/12_create-shards.up.sql new file mode 100644 index 00000000000..1af658682ae --- /dev/null +++ b/quickwit/quickwit-metastore/migrations/postgresql/12_create-shards.up.sql @@ -0,0 +1,14 @@ +CREATE TYPE SHARD_STATE AS ENUM ('unspecified', 'open', 'unavailable', 'closed'); + +CREATE TABLE IF NOT EXISTS shards ( + index_uid VARCHAR(282) NOT NULL, + source_id VARCHAR(255) NOT NULL, + shard_id BIGSERIAL, + leader_id VARCHAR(255) NOT NULL, + follower_id VARCHAR(255), + shard_state SHARD_STATE NOT NULL, + publish_position_inclusive bytea NOT NULL, + publish_token VARCHAR(255), + PRIMARY KEY (index_uid, source_id, shard_id), + FOREIGN KEY (index_uid) REFERENCES indexes (index_uid) +); \ No newline at end of file