-- Albums gain an owner: the tenancy root. Photos, shares, ratings and tags -- all hang off albums, so this single column scopes everything. alter table albums add column owner_id uuid references users(id); -- Existing albums belong to the instance's original photographer. update albums set owner_id = (select id from users order by created_at limit 1); alter table albums alter column owner_id set not null; create index albums_owner_idx on albums (owner_id);