SQL recipes
Unique constraint when creating a table
Example of table
CREATE TABLE notifications_sent(
user_id INT NOT NULL REFERENCES users(id),
notification_identifier INT NOT NULL,
ts TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
UNIQUE (user_id, notification_identifier)
);
UNIQUE (col1, col2)