ALTER TABLE social.badge_meta DROP CONSTRAINT IF EXISTS badge_meta_pkey;
ALTER TABLE social.badge_meta RENAME TO badge_meta_old;
CREATE TABLE social.badge_meta
(
    id bigserial PRIMARY KEY,
    badge_id text NOT NULL,
    icon text
);
CREATE UNIQUE INDEX ON social.badge_meta (badge_id);
INSERT INTO social.badge_meta(badge_id, icon) SELECT badge_id, icon FROM social.badge_meta_old;
DROP TABLE social.badge_meta_old;