docs: card1 (версии, документ, auth Postgres_TG_Bots); миграция 002 parent_id+unique active; спринт1+бэклог под Node

Made-with: Cursor
This commit is contained in:
Константин Лебединский
2026-04-24 19:17:46 +05:00
parent 93dcfcf4ff
commit 4eeb3fbc62
4 changed files with 238 additions and 0 deletions
@@ -0,0 +1,14 @@
-- Version chain: parent link + at most one active version per test chain
-- Aligns with docs/revision_task/card1.md (V.1)
ALTER TABLE test_versions
ADD COLUMN IF NOT EXISTS parent_id UUID REFERENCES test_versions(id) ON DELETE RESTRICT;
COMMENT ON COLUMN test_versions.parent_id IS 'Previous version in chain; NULL for first version';
-- Only one active version per tests.id (chain)
CREATE UNIQUE INDEX IF NOT EXISTS uq_test_versions_one_active_per_test
ON test_versions (test_id)
WHERE is_active = true;
CREATE INDEX IF NOT EXISTS idx_test_versions_parent_id ON test_versions (parent_id);