diff --git a/src/content/docs/fundamentals/account/change-super-admin.mdx b/src/content/docs/fundamentals/account/change-super-admin.mdx index 71c4c8077d2d646..7df058df1b189bf 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