telebit/internal/mgmt/authstore/insert.sql

11 lines
282 B
MySQL
Raw Normal View History

2020-05-30 09:52:27 +00:00
BEGIN;
LOCK TABLE authorizations IN SHARE ROW EXCLUSIVE MODE;
INSERT INTO authorizations
(slug, shared_key, public_key)
SELECT 'xxx-client-1', 'xxxx-yyyy-zzzz', 'somehash'
WHERE
NOT EXISTS (
SELECT slug FROM authorizations WHERE slug = 'xxx-client-1'
);
COMMIT;