Skip to content

[Feature Request] Add schema generation API generate #13

Description

@good-jinu

Thank you for building and maintaining unadapter! It's an amazing tool that really simplifies managing dynamic database adapters.


Old request

Feature Request

I would like to request a schema generation feature for unadapter.

While unadapter currently provides an adapter-agnostic way to handle live database migrations via getMigrations(), it lacks a standalone code/schema generation mechanism. In comparison, better-auth (which unadapter's architecture is based on) provides a built-in CLI that allows users to generate the required database schemas or migration files based on configured tables and plugins:

npx auth@latest generate

I'm a Library author building on top of unadapter and and try to expose package's own CLI. A very common command is a generate step that writes out a schema file:

npx my-lib generate

This kind of command needs to produce schema output from the schema definition. At this point, there is no database to connect to

Summary

unadapter can run and compile migrations through getMigrations(), but every path through it requires a live database connection. There is currently no public API to turn a TablesSchema into a schema string (SQL DDL, and Prisma/Drizzle) offline, without connecting to a database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions