Skip to content

Generate full DB schema file #30

@AviDuda

Description

@AviDuda

The Go version of sqlc generates the models.go file which includes structs for all tables, which later get referenced in specific queries.
Would it be possible to generate a type per table also in TS?

My use case: I'm in a codebase which is using raw SQL via mysql2. I didn't decide yet if I'll move everything to sqlc, but I'd really like to at least use correct values from the DB schema (currently, there may be some lies about fields being/not being nullable all over the code).
Generated sqlc queries could then also reference the model if possible, just like it's done in Go.

For now, I'm generating types like this for all tables which works, but I'd appreciate if it was auto-generated (as I may forget to add a new query when creating a new table).

-- name: User :one
SELECT * FROM user LIMIT 1;

-- name: SomeOtherTable :one
SELECT * FROM some_other_table LIMIT 1;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions