-- Company accounts (orgs). Every repository now lives under an owner: owner/project. -- do_name keeps the Durable Object key, so repos first pushed under a flat name keep their storage. CREATE TABLE IF NOT EXISTS orgs (handle TEXT PRIMARY KEY COLLATE NOCASE, name TEXT NOT NULL, domain TEXT, about TEXT, created_at INTEGER NOT NULL); CREATE TABLE IF NOT EXISTS org_members (org TEXT NOT NULL, account_id TEXT NOT NULL, role TEXT NOT NULL DEFAULT 'member', PRIMARY KEY (org, account_id)); CREATE INDEX IF NOT EXISTS org_members_account ON org_members (account_id); ALTER TABLE repos ADD COLUMN owner TEXT; ALTER TABLE repos ADD COLUMN do_name TEXT; UPDATE repos SET do_name = name WHERE do_name IS NULL; CREATE INDEX IF NOT EXISTS repos_owner ON repos (owner);