-- 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.';