private structures

This commit is contained in:
Your Name 2026-08-19 09:51:07 -04:00
parent 1f7dbf21e0
commit e179814859
6 changed files with 243 additions and 18 deletions

View file

@ -0,0 +1,15 @@
-- Private structures. A structure is public by default (private = 0); when
-- private = 1 only the users listed in structure_members may reach its routes,
-- mount its dbs, or open it in the workshop — a flat set of equals, no creator
-- or owner. Enforcement lives in the platform (index.js / plumbing.js), never in
-- user code — see canAccessStructure in db.js.
ALTER TABLE structures ADD COLUMN private INTEGER NOT NULL DEFAULT 0;
CREATE TABLE structure_members (
structure_id INTEGER NOT NULL,
user_id INTEGER NOT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY(structure_id, user_id),
FOREIGN KEY(structure_id) REFERENCES structures(id),
FOREIGN KEY(user_id) REFERENCES users(id)
);