create table if not exists groups ( contact_id integer not null references contacts(id) on delete cascade, name text not null ); alter table contact_mentions rename to journal_mentions; alter table journal_mentions add column url text not null default ''; update journal_mentions set url = '/contact/'||contact_id; alter table journal_mentions drop column contact_id;