From 2da64e885c8d830845330a93e767e7fa57f2fbb6 Mon Sep 17 00:00:00 2001
From: Jean-Paul Calderone <exarkun@twistedmatrix.com>
Date: Fri, 23 Jul 2021 09:15:51 -0400
Subject: [PATCH] explain this schema change too

---
 src/_zkapauthorizer/schema.py | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/_zkapauthorizer/schema.py b/src/_zkapauthorizer/schema.py
index a8c6b75..27890a3 100644
--- a/src/_zkapauthorizer/schema.py
+++ b/src/_zkapauthorizer/schema.py
@@ -208,6 +208,17 @@ _UPGRADES = {
         """,
 
         """
+        -- Give each unblinded token a reference to the [redemption-groups]
+        -- table identifying the group that token arrived with.  This lets us
+        -- act collectively on tokens from these groups and identify tokens
+        -- which are spendable.
+        --
+        -- The default value is provided for rows that
+        -- existed prior to this upgrade which had no group association.  For
+        -- unblinded tokens to exist at all there must be at least one voucher
+        -- in the vouchers table.  [redemption-groups] will therefore have at
+        -- least one row added to it (by the statement a few lines above).
+        -- Note that SQLite3 rowid numbering begins at 1.
         ALTER TABLE [unblinded-tokens] ADD COLUMN [redemption-group] integer DEFAULT 1
         """,
     ],
-- 
GitLab