Limit likes to one per-user per-building (db constraint)
This commit is contained in:
parent
9450f29449
commit
da64c153fc
@ -84,6 +84,3 @@ CREATE TABLE IF NOT EXISTS building_user_likes (
|
||||
);
|
||||
CREATE INDEX building_likes_idx ON building_user_likes ( building_id );
|
||||
CREATE INDEX user_likes_idx ON building_user_likes ( user_id );
|
||||
|
||||
-- One like per-building, per-user
|
||||
-- ALTER TABLE building_user_likes ADD CONSTRAINT building_like_once UNIQUE (building_id, user_id);
|
||||
|
2
migrations/005.limit-likes.down.sql
Normal file
2
migrations/005.limit-likes.down.sql
Normal file
@ -0,0 +1,2 @@
|
||||
-- Don't limit likes
|
||||
ALTER TABLE building_user_likes DROP CONSTRAINT building_like_once;
|
2
migrations/005.limit-likes.up.sql
Normal file
2
migrations/005.limit-likes.up.sql
Normal file
@ -0,0 +1,2 @@
|
||||
-- One like per-building, per-user
|
||||
ALTER TABLE building_user_likes ADD CONSTRAINT building_like_once UNIQUE (building_id, user_id);
|
Loading…
Reference in New Issue
Block a user