Deck version update

This commit is contained in:
gitea
2026-02-14 10:59:22 +01:00
parent 32c786fa24
commit 6009ce5ec2
14 changed files with 1008 additions and 143 deletions
@@ -0,0 +1,13 @@
-- Versioning for published decks; used to detect when community copies are outdated.
-- Run in Supabase SQL Editor (Dashboard → SQL Editor) if not using Supabase CLI migrations.
-- Version of this deck (v1, v2, ...). Bumped when a published deck is updated.
ALTER TABLE omotomo.decks
ADD COLUMN IF NOT EXISTS version integer NOT NULL DEFAULT 1;
-- For copies: version of the source deck at copy time. NULL = copied before versioning.
ALTER TABLE omotomo.decks
ADD COLUMN IF NOT EXISTS copied_from_version integer NULL;
COMMENT ON COLUMN omotomo.decks.version IS 'Incremented when deck (that is or was published) is updated; displayed as v1, v2, etc.';
COMMENT ON COLUMN omotomo.decks.copied_from_version IS 'Version of the source deck at copy time; used to show "Update" when source has a newer version.';
@@ -0,0 +1,9 @@
-- Run this in Supabase SQL Editor if "Update" never appears on community copies
-- (or you see errors about version / copied_from_version).
-- Uses schema omotomo (match your app's db.schema in src/lib/supabase.js).
ALTER TABLE omotomo.decks
ADD COLUMN IF NOT EXISTS version integer NOT NULL DEFAULT 1;
ALTER TABLE omotomo.decks
ADD COLUMN IF NOT EXISTS copied_from_version integer NULL;