internal/store/migrations/0076_org_limits.up.sql

695cb925d1f99f7735883046e455cdc436602cb1
gitbay/internal/store/migrations/0076_org_limits.up.sql

14 lines · 729 bytes

 1-- Quotas for organizations: limits.max_orgs_per_user counts orgs by the
 2-- account that created them; max_repos_per_org and max_bytes_per_org cap
 3-- each org, with per-org overrides. NULL means the configured default.
 4-- created_by carries no foreign key: ids are never reused (#306), and an
 5-- org outlives the account that made it.
 6ALTER TABLE orgs ADD COLUMN created_by INTEGER;
 7ALTER TABLE orgs ADD COLUMN repo_limit INTEGER;
 8ALTER TABLE orgs ADD COLUMN byte_limit INTEGER;
 9ALTER TABLE users ADD COLUMN org_limit INTEGER;
10UPDATE orgs SET created_by = (
11    SELECT m.user_id FROM org_members m
12    WHERE m.org_id = orgs.id AND m.role = 'admin'
13    ORDER BY m.rowid LIMIT 1);
14CREATE INDEX orgs_created_by ON orgs(created_by);
Keyboard shortcuts

Global

⌘K
Command palette & jump
/
Focus search
?
Show this help
g d
Dashboard
g e
Explore repositories
g n
Notifications

Repository & editor

t
Find file in repository
y
Copy immutable SHA permalink
g c
Code tab
g i
Issues tab
g m
Merge requests tab
g b
Builds tab
⌘↵
Submit active form