mirror of
https://github.com/modrinth/code.git
synced 2026-08-24 16:44:51 +00:00
* updated at cols + search by path * speed up scanning * migration does not auto-set updated_at * merge migrations
61 lines
3.5 KiB
JSON
61 lines
3.5 KiB
JSON
{
|
|
"db_name": "PostgreSQL",
|
|
"query": "\n WITH project_ids AS (\n SELECT unnest($1::bigint[]) AS project_id\n ),\n detail_states AS (\n SELECT\n p.project_id,\n COALESCE(\n BOOL_OR(\n didws.status = 'pending'\n AND dri.issue_type != $3\n ),\n FALSE\n ) AS has_pending_detail,\n COALESCE(\n BOOL_OR(\n didws.status = 'unsafe'\n AND dri.issue_type != $3\n ),\n FALSE\n ) AS has_unsafe_detail,\n COALESCE(\n BOOL_OR(\n didws.status = 'pending'\n AND dri.issue_type = $3\n ),\n FALSE\n ) AS has_dummy\n FROM project_ids p\n LEFT JOIN delphi_issue_details_with_statuses didws\n ON didws.project_id = p.project_id\n LEFT JOIN delphi_report_issues dri ON dri.id = didws.issue_id\n GROUP BY p.project_id\n )\n SELECT\n p.project_id AS \"project_id!: DBProjectId\",\n p.has_pending_detail AS \"has_pending_detail!\",\n p.has_unsafe_detail AS \"has_unsafe_detail!\",\n p.has_dummy AS \"has_dummy!\",\n (\n SELECT t.id\n FROM threads t\n WHERE t.mod_id = p.project_id\n ORDER BY t.id\n LIMIT 1\n ) AS \"thread_id: DBThreadId\",\n (\n SELECT tm.body->>'type'\n FROM threads t\n INNER JOIN threads_messages tm ON tm.thread_id = t.id\n WHERE\n t.mod_id = p.project_id\n AND tm.body->>'type' = ANY($2::text[])\n ORDER BY tm.created DESC, tm.id DESC\n LIMIT 1\n ) AS \"last_tech_review_message_type\",\n (\n SELECT dr.id\n FROM versions v\n INNER JOIN files f ON f.version_id = v.id\n INNER JOIN delphi_reports dr ON dr.file_id = f.id\n WHERE v.mod_id = p.project_id\n ORDER BY dr.created DESC, dr.id DESC\n LIMIT 1\n ) AS \"report_id: DelphiReportId\"\n FROM detail_states p\n ",
|
|
"describe": {
|
|
"columns": [
|
|
{
|
|
"ordinal": 0,
|
|
"name": "project_id!: DBProjectId",
|
|
"type_info": "Int8"
|
|
},
|
|
{
|
|
"ordinal": 1,
|
|
"name": "has_pending_detail!",
|
|
"type_info": "Bool"
|
|
},
|
|
{
|
|
"ordinal": 2,
|
|
"name": "has_unsafe_detail!",
|
|
"type_info": "Bool"
|
|
},
|
|
{
|
|
"ordinal": 3,
|
|
"name": "has_dummy!",
|
|
"type_info": "Bool"
|
|
},
|
|
{
|
|
"ordinal": 4,
|
|
"name": "thread_id: DBThreadId",
|
|
"type_info": "Int8"
|
|
},
|
|
{
|
|
"ordinal": 5,
|
|
"name": "last_tech_review_message_type",
|
|
"type_info": "Text"
|
|
},
|
|
{
|
|
"ordinal": 6,
|
|
"name": "report_id: DelphiReportId",
|
|
"type_info": "Int8"
|
|
}
|
|
],
|
|
"parameters": {
|
|
"Left": [
|
|
"Int8Array",
|
|
"TextArray",
|
|
"Text"
|
|
]
|
|
},
|
|
"nullable": [
|
|
null,
|
|
null,
|
|
null,
|
|
null,
|
|
null,
|
|
null,
|
|
null
|
|
]
|
|
},
|
|
"hash": "6241bc72a80de01fd8e5506442da48057c24dece008dbf2c00c6ec135d8cef41"
|
|
}
|