<gh_stars>100-1000
# --- !Ups

DELETE FROM PROJECT_VISITATION
WHERE ID NOT IN
      (SELECT MAX(ID)
       FROM PROJECT_VISITATION
       GROUP BY PROJECT_ID, RECENTLY_VISITED_PROJECTS_ID);

ALTER TABLE PROJECT_VISITATION
ADD CONSTRAINT UC_VISITED_PROJECTS UNIQUE (PROJECT_ID, RECENTLY_VISITED_PROJECTS_ID);

# --- !Downs

ALTER TABLE PROJECT_VISITATION DROP CONSTRAINT UC_VISITED_PROJECTS;
