Add a list of SQL queries to interface with stalwart
This commit is contained in:
parent
21d93e379c
commit
1a5573f68d
1 changed files with 65 additions and 0 deletions
65
queries.md
Normal file
65
queries.md
Normal file
|
|
@ -0,0 +1,65 @@
|
||||||
|
# Stalwart queries
|
||||||
|
|
||||||
|
## name
|
||||||
|
|
||||||
|
100 GB quota
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT name, 'individual' as type, password as secret, '' as description, 107374182400 as quota
|
||||||
|
FROM accounts
|
||||||
|
WHERE secret != NULL AND name = ?
|
||||||
|
```
|
||||||
|
|
||||||
|
## members
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT NULL as member_of WHERE 1=0
|
||||||
|
```
|
||||||
|
|
||||||
|
## recipients
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT name
|
||||||
|
FROM emails JOIN accounts on emails.id = accounts.id
|
||||||
|
WHERE mail = ?
|
||||||
|
```
|
||||||
|
|
||||||
|
## emails
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT mail as address
|
||||||
|
FROM (
|
||||||
|
SELECT name || '@familleboyer.net' as mail, 0 as type FROM accounts WHERE name = ?
|
||||||
|
UNION
|
||||||
|
SELECT mail, (alias)::int + 1 as type
|
||||||
|
FROM emails JOIN accounts ON accounts.id = emails.id
|
||||||
|
WHERE name = ?
|
||||||
|
) as mails
|
||||||
|
ORDER BY type
|
||||||
|
```
|
||||||
|
|
||||||
|
## verify
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT mail as address
|
||||||
|
FROM (
|
||||||
|
SELECT name || '@familleboyer.net' as mail FROM accounts
|
||||||
|
UNION
|
||||||
|
SELECT mail
|
||||||
|
FROM emails JOIN accounts ON accounts.id = emails.id
|
||||||
|
WHERE NOT alias
|
||||||
|
) as mails
|
||||||
|
WHERE mail LIKE '%' || ? || '%' ORDER BY mail LIMIT 5
|
||||||
|
```
|
||||||
|
|
||||||
|
## expand
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT NULL as address WHERE 1=0
|
||||||
|
```
|
||||||
|
|
||||||
|
## domains
|
||||||
|
|
||||||
|
```sql
|
||||||
|
SELECT 1 WHERE ? = 'familleboyer.net'
|
||||||
|
```
|
||||||
Loading…
Add table
Add a link
Reference in a new issue