Skip to main content

max / makenotwork

450 B · 15 lines History Blame Raw
1 {
2 "db_name": "PostgreSQL",
3 "query": "UPDATE promo_codes SET use_count = use_count + 1 WHERE id = $1 AND (max_uses IS NULL OR use_count < max_uses) AND (expires_at IS NULL OR expires_at > NOW()) AND (starts_at IS NULL OR starts_at <= NOW())",
4 "describe": {
5 "columns": [],
6 "parameters": {
7 "Left": [
8 "Uuid"
9 ]
10 },
11 "nullable": []
12 },
13 "hash": "7a386b4a669d5ea1c1a49daea27030400e08d3e4b90c673c4568acf1dba27fbb"
14 }
15