fabrica

hanna/fabrica

1158 bytes
Raw
1-- Releases: tag-based release notes with optional uploaded assets. Toggleable
2-- per repository (releases_enabled), like issues and pull requests.
3ALTER TABLE repos ADD COLUMN releases_enabled BOOLEAN NOT NULL DEFAULT TRUE;
4
5CREATE TABLE releases (
6 id TEXT PRIMARY KEY,
7 repo_id TEXT NOT NULL REFERENCES repos(id) ON DELETE CASCADE,
8 tag TEXT NOT NULL,
9 name TEXT NOT NULL,
10 body TEXT,
11 is_prerelease BOOLEAN NOT NULL DEFAULT FALSE,
12 is_draft BOOLEAN NOT NULL DEFAULT FALSE,
13 author_id TEXT REFERENCES users(id) ON DELETE SET NULL,
14 created_at BIGINT NOT NULL,
15 updated_at BIGINT NOT NULL
16);
17CREATE UNIQUE INDEX idx_releases_repo_tag ON releases (repo_id, tag);
18
19CREATE TABLE release_assets (
20 id TEXT PRIMARY KEY,
21 release_id TEXT NOT NULL REFERENCES releases(id) ON DELETE CASCADE,
22 name TEXT NOT NULL,
23 size BIGINT NOT NULL,
24 content_type TEXT NOT NULL,
25 download_count BIGINT NOT NULL DEFAULT 0,
26 created_at BIGINT NOT NULL
27);
28CREATE INDEX idx_release_assets_release ON release_assets (release_id);