OXYGENHUB
◆ v0.9.24 oxygenhub / crates / hub / migrations-pg / 0103_attachments.sql
664 B · SQL · last changed OxygenHub 0.9.19: attachments on issues and comments, over the API and oh --attach; images by their bytes shown in place, everything else a download (closes #350) 4 days ago source blame history raw
1
-- Files attached to issues, comments and proposals (oxygenhub#350): kept by
2
-- content in the hub's assets store, as release assets are, and served
3
-- under the repository's read rules.
4
CREATE TABLE attachments (
5
    id           BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
6
    repo_id      BIGINT NOT NULL REFERENCES repositories(id) ON DELETE CASCADE,
7
    name         TEXT NOT NULL,
8
    size         BIGINT NOT NULL,
9
    hash         TEXT NOT NULL,
10
    content_type TEXT NOT NULL,
11
    uploader_id  BIGINT,
12
    created_ms   BIGINT NOT NULL
13
);
14
CREATE INDEX attachments_repo ON attachments (repo_id);
15
CREATE INDEX attachments_hash ON attachments (hash);