~singpolyma/jmp-schemas

jmp-schemas/verify/unused_invites.sql -rw-r--r-- 315 bytes
395bb797Stephen Paul Weber Tag for notify on top up an expired account a month ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- Verify jmp:unused_invites on pg

BEGIN;

INSERT INTO invites (creator_id)
	VALUES ('boop');
INSERT INTO invites (creator_id, used_by_id, used_at)
	VALUES ('boop', 'otherone', LOCALTIMESTAMP);

SELECT 1/count(1) FROM (
	SELECT count(1) AS a FROM unused_invites WHERE creator_id='boop'
) s WHERE a = 1;

ROLLBACK;