forge
Explore
Log in

Don't you dare go Hollow

forge

Clone
★ 0

0 watching0 forksRustAGPL-3.07.1 MiB490f099Tahinli7 hours ago322 commits

0061_packages.sql35 lines, 1.5 KiBHistoryRawDownload
1-- Package registries: the packages an owner (user or org) publishes, and their versions. `kind`
2-- names the registry format ('cargo' now; a container registry would add 'oci' rows beside them).
3-- `name_key` is the lowercase name that the index and the URLs use; `name` keeps the spelling of
4-- the first publish. The .crate bytes live in blob storage under `packages/<version id>`; a
5-- version row keeps the checksum, the index line and the README text. `repo_id` links a package
6-- to a repo on this forge, found from the crate's `repository` field.
7
8CREATE TABLE packages (
9 id TEXT PRIMARY KEY,
10 owner_id TEXT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
11 kind TEXT NOT NULL,
12 name TEXT NOT NULL,
13 name_key TEXT NOT NULL,
14 repo_id TEXT REFERENCES repos(id) ON DELETE SET NULL,
15 private INTEGER NOT NULL DEFAULT 0,
16 created_at TEXT NOT NULL,
17 updated_at TEXT NOT NULL,
18 UNIQUE (owner_id, kind, name_key)
19);
20CREATE INDEX packages_repo ON packages(repo_id);
21
22CREATE TABLE package_versions (
23 id TEXT PRIMARY KEY,
24 package_id TEXT NOT NULL REFERENCES packages(id) ON DELETE CASCADE,
25 version TEXT NOT NULL,
26 yanked INTEGER NOT NULL DEFAULT 0,
27 checksum TEXT NOT NULL,
28 size INTEGER NOT NULL,
29 index_json TEXT NOT NULL,
30 description TEXT,
31 readme TEXT,
32 publisher_id TEXT NOT NULL REFERENCES users(id),
33 created_at TEXT NOT NULL,
34 UNIQUE (package_id, version)
35);