forge
ExploreLog in

Tahinli/forge

public
0 watching
★ 0
1.3 KiB
1-- Releases: a tag-anchored announcement with optional downloadable assets. A release points at
2-- a tag (created as a lightweight tag on demand) and keeps its own title and body. Deleting a
3-- release keeps the git tag. Drafts have published_at NULL and are visible only to writers.
4-- Asset bytes live in the blob store under assets/<asset id>; only metadata is here.
5
6CREATE TABLE releases (
7 id TEXT PRIMARY KEY,
8 repo_id TEXT NOT NULL REFERENCES repos(id),
9 tag TEXT NOT NULL,
10 target_oid TEXT NOT NULL,
11 title TEXT NOT NULL,
12 body TEXT NOT NULL DEFAULT '',
13 draft INTEGER NOT NULL DEFAULT 0,
14 prerelease INTEGER NOT NULL DEFAULT 0,
15 author_id TEXT NOT NULL REFERENCES users(id),
16 created_at TEXT NOT NULL,
17 published_at TEXT,
18 UNIQUE (repo_id, tag)
19);
20
21CREATE TABLE release_assets (
22 id TEXT PRIMARY KEY,
23 release_id TEXT NOT NULL REFERENCES releases(id) ON DELETE CASCADE,
24 name TEXT NOT NULL,
25 size INTEGER NOT NULL,
26 sha256 TEXT NOT NULL,
27 content_type TEXT NOT NULL,
28 download_count INTEGER NOT NULL DEFAULT 0,
29 uploader_id TEXT NOT NULL REFERENCES users(id),
30 created_at TEXT NOT NULL,
31 UNIQUE (release_id, name)
32);