knex-types
knex-types copied to clipboard
Support for domains
In my database I use custom domain like:
Create Domain email As text;
Create Domain phone_number As varChar(16);
Currently when I generate the types, it seams to work in general but fails for arrays.
In this example all columns are from type email
or email[]
SQL
Create Table private.email (
email_from email not null,
email_reply_to email null,
email_to email[] not null,
email_cc email[] null,
email_bcc email[] null,
TS
export type PrivateEmail = {
from: string;
reply_to: string | null;
to: unknown[];
cc: unknown[] | null;
In my opinion, it would be a nice addition if the domain got its own type. e.g.
SQL
Create Domain email As text;
TS
export type email = string;