alter table sites3 add column publ_id varchar;

-- This generates 10 random hex chars. Future publ ids will be
-- generated by the app server instead, and use base32? 36? + a crypto random gen.
update sites3 set publ_id = substring(md5(random()::text) from 0 for 10 + 1);

alter table sites3 alter column publ_id set not null;

create unique index sites_publid_u on sites3 (publ_id);

