diff --git a/migrations/V134__friends_and_foes_constraint.sql b/migrations/V134__friends_and_foes_constraint.sql new file mode 100644 index 00000000..413a1063 --- /dev/null +++ b/migrations/V134__friends_and_foes_constraint.sql @@ -0,0 +1,5 @@ +DELETE FROM friends_and_foes WHERE user_id = subject_id; + +ALTER TABLE friends_and_foes +ADD CONSTRAINT friends_and_foes_cannot_reference_self +CHECK (user_id <> subject_id);