docs: move drizzle example to supabase (#45935)

## I have read the
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
file.

YES/NO

## What kind of change does this PR introduce?

Bug fix, feature, docs update, ...

## What is the current behavior?

Please link any relevant issues here.

## What is the new behavior?

Feel free to include screenshots if it includes visual changes.

## Additional context

Add any other context or screenshots.


<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Documentation**
* Updated the Drizzle ORM guide to a Deno-native configuration,
replacing the prior import-map example with embedded Deno examples and
references to Edge Function samples.

* **New Features**
* Added an Edge Function example demonstrating Drizzle + PostgreSQL on
Deno.
* Added a shared database schema example including user and countries
table definitions.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/supabase/supabase/pull/45935?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
This commit is contained in:
Rodrigo MansueliandChris Chinchilla authored and GitHub committed 2026-05-21 12:25:49 +00:00
1 parent 72cebe3976
commit f3789a39c4
4 files changed
+56 -28

No files matched your search

@@ -0,0 +1,16 @@
import { pgTable, serial, text, timestamp } from 'drizzle-orm/pg-core'
export const user = pgTable('user', {
id: serial('id'),
name: text('name'),
email: text('email'),
password: text('password'),
role: text('role').$type<'admin' | 'customer'>(),
createdAt: timestamp('created_at'),
updatedAt: timestamp('updated_at'),
})
export const countries = pgTable('countries', {
id: serial('id'),
name: text('name'),
})
@@ -0,0 +1,7 @@
{
"imports": {
"drizzle-orm": "npm:drizzle-orm@0.29.1",
"drizzle-orm/": "npm:/drizzle-orm@0.29.1/",
"postgres": "npm:postgres@3.4.3"
}
}
@@ -0,0 +1,14 @@
import { drizzle } from 'drizzle-orm/postgres-js'
import postgres from 'postgres'
import { countries } from '../_shared/schema.ts'
const connectionString = Deno.env.get('SUPABASE_DB_URL')!
// Disable prefetch as it is not supported for "Transaction" pool mode
const client = postgres(connectionString, { prepare: false })
const db = drizzle(client)
Deno.serve(async (_req) => {
const allCountries = await db.select().from(countries)
return Response.json(allCountries)
})