16 lines
737 B
MySQL
16 lines
737 B
MySQL
|
|
-- 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)
|
||
|
|
);
|