Skip to main content

max / makenotwork

610 B · 15 lines History Blame Raw
1 -- Items can be unlisted (hidden from project page, accessible via bundle or direct URL)
2 ALTER TABLE items ADD COLUMN listed BOOLEAN NOT NULL DEFAULT true;
3
4 -- Bundle contents: which items are included in a bundle-type item
5 CREATE TABLE bundle_items (
6 bundle_id UUID NOT NULL REFERENCES items(id) ON DELETE CASCADE,
7 item_id UUID NOT NULL REFERENCES items(id) ON DELETE CASCADE,
8 sort_order INT NOT NULL DEFAULT 0,
9 added_at TIMESTAMPTZ NOT NULL DEFAULT NOW(),
10 PRIMARY KEY (bundle_id, item_id),
11 CHECK (bundle_id != item_id)
12 );
13
14 CREATE INDEX idx_bundle_items_item ON bundle_items(item_id);
15