Files
archie/internal/infrastructure/postgres/migrations/0041_session_org.sql
T
sam 0fcf792db3 feat(gateway): chat sessions belong to one org
Sessions carry an org; listing, reading and writing a session, its
messages and its turns are limited to the caller's org. Another org's
session reads as not found and cannot be overwritten or appended to.
Sessions from before orgs belong to the system org.
2026-10-10 18:57:26 +11:00

13 lines
371 B
SQL

-- A chat session belongs to one org; its messages and turns are reached only
-- through it. Sessions from before orgs belong to the system org.
-- +goose Up
ALTER TABLE sessions ADD COLUMN org_id text NOT NULL DEFAULT 'org-sys';
CREATE INDEX idx_sessions_org ON sessions (org_id);
-- +goose Down
DROP INDEX idx_sessions_org;
ALTER TABLE sessions DROP COLUMN org_id;