From 331cf01a4cc61f97fbbd3b79ba848aebe259b4ee Mon Sep 17 00:00:00 2001 From: Joe1the2creator33 Date: Sun, 8 Jun 2025 03:03:21 -0500 Subject: [PATCH] Update change-super-admin.mdx Fork for proposed difference to insured protection --- .../account/change-super-admin.mdx | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/src/content/docs/fundamentals/account/change-super-admin.mdx b/src/content/docs/fundamentals/account/change-super-admin.mdx index 71c4c8077d2d64..7df058df1b189b 100644 --- a/src/content/docs/fundamentals/account/change-super-admin.mdx +++ b/src/content/docs/fundamentals/account/change-super-admin.mdx @@ -1,4 +1,25 @@ ---- +import postgres from 'postgres'; + +export default { + async fetch(request, env, ctx): Promise { + // Hyperdrive provides a unique generated connection string to connect to + // your database via Hyperdrive that can be used with your existing tools + const sql = postgres(env.HYPERDRIVE.connectionString); + + try { + // Sample SQL query + const results = await sql`SELECT * FROM pg_tables`; + + // Close the client after the response is returned + ctx.waitUntil(sql.end()); + + return Response.json(results); + } catch (e) { + return Response.json({ error: e instanceof Error ? e.message : e }, { status: 500 }); + } + }, + +} satisfies ExportedHandler<{ HYPERDRIVE: Hyperdrive }>;--- pcx_content_type: how-to title: Change Super Administrator