ci: add sqlx offline queries

This commit is contained in:
Lowder
2026-02-22 21:55:16 +05:00
parent 726804e73d
commit a8e5c58490
6 changed files with 133 additions and 1 deletions
+1 -1
View File
@@ -31,7 +31,7 @@ COPY --from=build /build/website/static ./static
COPY --from=build /build/website/templates ./templates
## ensure the container listens globally on port 8080
ENV ROCKET_ADDRESS=0.0.0.0
ENV ROCKET_ADDRESS=::
ENV ROCKET_PORT=8080
EXPOSE 8080
@@ -0,0 +1,34 @@
{
"db_name": "PostgreSQL",
"query": "SELECT *\n FROM whitelist\n WHERE $1 = domain\n OR $1 LIKE CONCAT('%.', domain)\n ORDER BY LENGTH(domain) DESC\n LIMIT 1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "domain",
"type_info": "Varchar"
},
{
"ordinal": 1,
"name": "rank",
"type_info": "Int4"
},
{
"ordinal": 2,
"name": "last_ok",
"type_info": "Timestamp"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
true,
true,
true
]
},
"hash": "5aa59a3d560beee3b4c2137e3a0e45552aa6a684356773f268f1f0cc226e5b5e"
}
@@ -0,0 +1,42 @@
{
"db_name": "PostgreSQL",
"query": "WITH bins AS (\n SELECT generate_series(0, $1 - 1) AS bin\n)\nSELECT\n b.bin as bin_id,\n b.bin * $2 + 1 AS bin_min_rank,\n (b.bin + 1) * $2 AS bin_max_rank,\n COUNT(case when not $3 or w.domain not like '%.co.uk' then 1 end) AS count\nFROM bins b\nLEFT JOIN whitelist w\n ON FLOOR(w.rank / $2) = b.bin\nGROUP BY b.bin\nORDER BY b.bin;",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "bin_id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "bin_min_rank",
"type_info": "Int4"
},
{
"ordinal": 2,
"name": "bin_max_rank",
"type_info": "Int4"
},
{
"ordinal": 3,
"name": "count",
"type_info": "Int8"
}
],
"parameters": {
"Left": [
"Int4",
"Int4",
"Bool"
]
},
"nullable": [
null,
null,
null,
null
]
},
"hash": "6a4cd9fd07e9ee53e6c2098b14fc6f4ab5b1704ffad21e615492b2889d9163f7"
}
@@ -0,0 +1,28 @@
{
"db_name": "PostgreSQL",
"query": "SELECT id, name FROM reporters WHERE token = $1",
"describe": {
"columns": [
{
"ordinal": 0,
"name": "id",
"type_info": "Int4"
},
{
"ordinal": 1,
"name": "name",
"type_info": "Varchar"
}
],
"parameters": {
"Left": [
"Text"
]
},
"nullable": [
false,
false
]
},
"hash": "78b942fd1bf87ab38b9fb1611decf1827e5343981ec88aa0022bd7c44cd5f9d0"
}
@@ -0,0 +1,16 @@
{
"db_name": "PostgreSQL",
"query": "INSERT INTO human_reports (id, source_ip, works) VALUES ($1, $2, $3)",
"describe": {
"columns": [],
"parameters": {
"Left": [
"Uuid",
"Varchar",
"Bool"
]
},
"nullable": []
},
"hash": "da78a4ed929ca7460cd98c7fb6b6ef10a987644e1b879af2782cf318f12f60b6"
}
@@ -0,0 +1,12 @@
{
"db_name": "PostgreSQL",
"query": "REFRESH MATERIALIZED VIEW whitelist",
"describe": {
"columns": [],
"parameters": {
"Left": []
},
"nullable": []
},
"hash": "ea9307414ca1375dea4b9ef49ddfb0d679bbd6971b2ca75d25fbaf6fdc04951d"
}