initial commit
[squeep-indie-auther] / src / db / postgres / sql / token-scopes-remove.sql
diff --git a/src/db/postgres/sql/token-scopes-remove.sql b/src/db/postgres/sql/token-scopes-remove.sql
new file mode 100644 (file)
index 0000000..dd667f2
--- /dev/null
@@ -0,0 +1,7 @@
+--
+DELETE FROM token_scope
+WHERE (code_id, scope_id) IN (
+       SELECT code_id, scope_id FROM token_scope ts
+               INNER JOIN scope s USING (scope_id)
+               WHERE scope = ANY($(removeScopes)) AND code_id = $(codeId)
+)