tag-lifecycle: owner close (status closed, gating + page) + move (copy details to new tag, close source) + legacy ?productid= redirect — verified with real tags 6 & 17
This commit is contained in:
@@ -16,7 +16,7 @@ CREATE TABLE IF NOT EXISTS tags (
|
||||
tag_code TEXT NOT NULL UNIQUE, -- printed on QR + NFC, public identifier
|
||||
owner_id BIGINT REFERENCES users(id),
|
||||
status TEXT NOT NULL DEFAULT 'unset'
|
||||
CHECK (status IN ('unset', 'active', 'suspended')),
|
||||
CHECK (status IN ('unset', 'active', 'suspended', 'closed')),
|
||||
item_type TEXT CHECK (item_type IN ('dog', 'cat', 'baggage', 'skis', 'other')),
|
||||
description TEXT,
|
||||
photo_url TEXT,
|
||||
@@ -93,3 +93,7 @@ ALTER TABLE orders ADD COLUMN IF NOT EXISTS amount NUMERIC(10,2) NOT NULL DEFAUL
|
||||
|
||||
-- Renewal tracking (lazy expiry): paid orders past renews_at are treated lapsed.
|
||||
ALTER TABLE orders ADD COLUMN IF NOT EXISTS renews_at TIMESTAMPTZ;
|
||||
|
||||
-- Tag lifecycle: closed state (owner close / moved-from). Idempotent.
|
||||
ALTER TABLE tags DROP CONSTRAINT IF EXISTS tags_status_check;
|
||||
ALTER TABLE tags ADD CONSTRAINT tags_status_check CHECK (status IN ('unset','active','suspended','closed'));
|
||||
|
||||
Reference in New Issue
Block a user