@jpgilldev / steid

steid/migrations/20260804093035_create_repositories.sql
633 BRaw
1-- Repositories are owned by an organisation, never directly by a user.
2--
3-- `unique (org_id, name)` is a pair, so two owners can each have a repo called the
4-- same thing; only one owner cannot have two. `collate nocase` on the column makes
5-- that constraint case-insensitive, matching RepoName, which lowercases on the way in.
6create table repositories (
7 id text primary key,
8 org_id text not null references orgs (id),
9 name text not null collate nocase,
10 description text,
11 visibility text not null,
12 unique (org_id, name)
13);
14
15create index repositories_org_id on repositories (org_id);