Add uniqueness constraint for meta_taggings

Description

As suggested by redsummernight in the PR for AO3-2452 (in this comment), it would be good to add a unique index on (meta_tag_id, sub_tag_id) to the meta_taggings table. There’s already a constraint in ruby to try to prevent duplicate MetaTaggings, but it would be better to enforce that constraint in the database, as well.

Activity

Show:
Sarken
June 24, 2019, 8:18 PM

From james:

ao3app@test-app10:~/app/current$ bundle exec rake db:migrate
== 20190611212339 AddUniqueIndexToMetaTaggings: migrating =====================
-- add_index(:meta_taggings, [:meta_tag_id, :sub_tag_id], {:unique=>true})
-> 4.9407s
-- remove_index(:meta_taggings, [:meta_tag_id])
-> 0.6319s
== 20190611212339 AddUniqueIndexToMetaTaggings: migrated (5.5730s) ============

So we can call this ready to go.

DeployedToBeta

Assignee

ticking instant

Reporter

Sarken

Roadmap

Tags

Priority

Medium

Affects versions

Fix versions

Components

BackEnd

Difficulty

Medium

Milestone

Internal 0.9