-- Link migrated blogs to legacy WillaEngine article ids
ALTER TABLE blogs
  ADD COLUMN IF NOT EXISTS old_id BIGINT;

CREATE UNIQUE INDEX IF NOT EXISTS blogs_business_old_id_unique
  ON blogs (business_id, old_id)
  WHERE old_id IS NOT NULL;
