Skip to content

Commit 9bb171d

Browse files
committed
Allow empty store_ids
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.
1 parent e4c8359 commit 9bb171d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

rust/impls/src/migrations.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ pub(crate) const MIGRATIONS: &[&str] = &[
2626
// We do not complain if the table already exists, as users of VSS could have already created this table
2727
"CREATE TABLE IF NOT EXISTS vss_db (
2828
user_token character varying(120) NOT NULL CHECK (user_token <> ''),
29-
store_id character varying(120) NOT NULL CHECK (store_id <> ''),
29+
store_id character varying(120) NOT NULL,
3030
key character varying(600) NOT NULL,
3131
value bytea NULL,
3232
version bigint NOT NULL,
3333
created_at TIMESTAMP WITH TIME ZONE,
3434
last_updated_at TIMESTAMP WITH TIME ZONE,
3535
PRIMARY KEY (user_token, store_id, key)
3636
);",
37+
"ALTER TABLE vss_db DROP CONSTRAINT IF EXISTS vss_db_store_id_check;",
3738
];
3839
#[cfg(test)]
3940
pub(crate) const DUMMY_MIGRATION: &str = "SELECT 1 WHERE FALSE;";

rust/impls/src/postgres/sql/v0_create_vss_db.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CREATE TABLE vss_db (
22
user_token character varying(120) NOT NULL CHECK (user_token <> ''),
3-
store_id character varying(120) NOT NULL CHECK (store_id <> ''),
3+
store_id character varying(120) NOT NULL,
44
key character varying(600) NOT NULL,
55
value bytea NULL,
66
version bigint NOT NULL,

0 commit comments

Comments
 (0)