diff --git a/.changeset/few-pets-relax.md b/.changeset/few-pets-relax.md new file mode 100644 index 0000000000..7e2682c274 --- /dev/null +++ b/.changeset/few-pets-relax.md @@ -0,0 +1,5 @@ +--- +"@astrojs/db": patch +--- + +Expose the Drizzle `alias` utility from `astro:db` to enable self-joins on a table. diff --git a/packages/db/src/runtime/virtual.ts b/packages/db/src/runtime/virtual.ts index ac118d6930..4159e74c1a 100644 --- a/packages/db/src/runtime/virtual.ts +++ b/packages/db/src/runtime/virtual.ts @@ -92,3 +92,5 @@ export { max, min, } from 'drizzle-orm'; + +export { alias } from 'drizzle-orm/sqlite-core'; diff --git a/packages/db/virtual.d.ts b/packages/db/virtual.d.ts index efe9e8387d..6c93137a20 100644 --- a/packages/db/virtual.d.ts +++ b/packages/db/virtual.d.ts @@ -42,4 +42,5 @@ declare module 'astro:db' { export const sumDistinct: RuntimeConfig['sumDistinct']; export const max: RuntimeConfig['max']; export const min: RuntimeConfig['min']; + export const alias: RuntimeConfig['alias']; }