Skip to main content

max / makenotwork

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