Expand seller store functionality
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
SET search_path TO atlas, public;
|
||||
|
||||
-- A link request exists before it belongs to a workspace, so it cannot use the
|
||||
-- normal workspace RLS policy. Its UUID is high entropy and the final token
|
||||
-- exchange additionally requires the PKCE verifier stored with the request.
|
||||
CREATE TABLE extension_link_requests (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
client_id TEXT NOT NULL,
|
||||
code_challenge TEXT NOT NULL,
|
||||
workspace_id UUID REFERENCES workspaces(id) ON DELETE RESTRICT,
|
||||
user_id UUID REFERENCES users(id) ON DELETE RESTRICT,
|
||||
approved_at TIMESTAMPTZ,
|
||||
consumed_at TIMESTAMPTZ,
|
||||
expires_at TIMESTAMPTZ NOT NULL,
|
||||
created_at TIMESTAMPTZ NOT NULL DEFAULT now(),
|
||||
CHECK (expires_at > created_at),
|
||||
CHECK ((workspace_id IS NULL AND user_id IS NULL AND approved_at IS NULL) OR (workspace_id IS NOT NULL AND user_id IS NOT NULL AND approved_at IS NOT NULL))
|
||||
);
|
||||
|
||||
CREATE INDEX ix_extension_link_requests_pending ON extension_link_requests (expires_at)
|
||||
WHERE approved_at IS NULL AND consumed_at IS NULL;
|
||||
|
||||
COMMENT ON TABLE extension_link_requests IS
|
||||
'Short-lived browser-to-extension pairing requests. Access is protected by unguessable IDs and PKCE, not workspace RLS, because the request is created before Web-session approval.';
|
||||
@@ -0,0 +1,5 @@
|
||||
SET search_path TO atlas, public;
|
||||
|
||||
-- The PKCE pairing prototype was replaced before release by the documented
|
||||
-- Web-login-state synchronization flow. Remove its unreferenced bootstrap table.
|
||||
DROP TABLE IF EXISTS extension_link_requests;
|
||||
@@ -0,0 +1,14 @@
|
||||
SET search_path TO atlas, public;
|
||||
|
||||
-- 同一来源商品重新采集时保留 collection_item / product 的稳定 ID,但使用新的
|
||||
-- 来源快照替换可再采集数据。素材任务携带快照版本,避免旧 Worker 任务回写旧素材。
|
||||
ALTER TABLE collection_items
|
||||
ADD COLUMN source_snapshot_revision BIGINT NOT NULL DEFAULT 1
|
||||
CHECK (source_snapshot_revision > 0);
|
||||
|
||||
ALTER TABLE collection_asset_transfers
|
||||
ADD COLUMN source_snapshot_revision BIGINT NOT NULL DEFAULT 1
|
||||
CHECK (source_snapshot_revision > 0);
|
||||
|
||||
CREATE INDEX ix_collection_asset_transfers_snapshot_queue
|
||||
ON collection_asset_transfers (collection_item_id, source_snapshot_revision, status, created_at);
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user