From 9bb171df3f97d9fa0f77ebdd918c1d71bb78ea96 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 24 Feb 2026 12:51:35 +0000 Subject: [PATCH] Allow empty `store_id`s Most VSS users don't actually care about the `store_id` - they have some data which they want to store for themselves (keyed on the authenticated user id) and that's it. There's not really any reason to force them to specify a `store_id`, the empty string is just as valid as any other. Thus we allow it here. --- rust/impls/src/migrations.rs | 3 ++- rust/impls/src/postgres/sql/v0_create_vss_db.sql | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/rust/impls/src/migrations.rs b/rust/impls/src/migrations.rs index 02d3f54..a39981b 100644 --- a/rust/impls/src/migrations.rs +++ b/rust/impls/src/migrations.rs @@ -26,7 +26,7 @@ pub(crate) const MIGRATIONS: &[&str] = &[ // We do not complain if the table already exists, as users of VSS could have already created this table "CREATE TABLE IF NOT EXISTS vss_db ( user_token character varying(120) NOT NULL CHECK (user_token <> ''), - store_id character varying(120) NOT NULL CHECK (store_id <> ''), + store_id character varying(120) NOT NULL, key character varying(600) NOT NULL, value bytea NULL, version bigint NOT NULL, @@ -34,6 +34,7 @@ pub(crate) const MIGRATIONS: &[&str] = &[ last_updated_at TIMESTAMP WITH TIME ZONE, PRIMARY KEY (user_token, store_id, key) );", + "ALTER TABLE vss_db DROP CONSTRAINT IF EXISTS vss_db_store_id_check;", ]; #[cfg(test)] pub(crate) const DUMMY_MIGRATION: &str = "SELECT 1 WHERE FALSE;"; diff --git a/rust/impls/src/postgres/sql/v0_create_vss_db.sql b/rust/impls/src/postgres/sql/v0_create_vss_db.sql index 8d91c25..5842dc4 100644 --- a/rust/impls/src/postgres/sql/v0_create_vss_db.sql +++ b/rust/impls/src/postgres/sql/v0_create_vss_db.sql @@ -1,6 +1,6 @@ CREATE TABLE vss_db ( user_token character varying(120) NOT NULL CHECK (user_token <> ''), - store_id character varying(120) NOT NULL CHECK (store_id <> ''), + store_id character varying(120) NOT NULL, key character varying(600) NOT NULL, value bytea NULL, version bigint NOT NULL,