Skip to content

Commit 81a3d1e

Browse files
committed
fixup: Add comments to MIGRATIONS list
1 parent de87130 commit 81a3d1e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

rust/impls/src/postgres_store.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,18 @@ const LOG_MIGRATION_STMT: &str = "INSERT INTO vss_db_upgrades VALUES($1);";
3939
#[cfg(test)]
4040
const GET_MIGRATION_LOG_STMT: &str = "SELECT upgrade_from FROM vss_db_upgrades;";
4141

42+
// APPEND-ONLY list of migration statements
43+
//
44+
// Each statement MUST be applied in-order, and only once per database.
45+
//
46+
// We make an exception for the vss_db table creation statement, as users of VSS could have initialized the table
47+
// themselves.
4248
const MIGRATIONS: &[&str] = &[
4349
"CREATE TABLE vss_db_version (db_version INTEGER);",
4450
"INSERT INTO vss_db_version VALUES(1);",
51+
// A write-only log of all the migrations performed on this database, useful for debugging and testing
4552
"CREATE TABLE vss_db_upgrades (upgrade_from INTEGER);",
46-
// We do not complain if the table already exists, as a previous version of VSS could have already created
47-
// this table
53+
// We do not complain if the table already exists, as users of VSS could have already created this table
4854
"CREATE TABLE IF NOT EXISTS vss_db (
4955
user_token character varying(120) NOT NULL CHECK (user_token <> ''),
5056
store_id character varying(120) NOT NULL CHECK (store_id <> ''),

0 commit comments

Comments
 (0)