You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using Kysely's code generation tool for a PostgreSQL database. The database contains an enum type for statuses, and I am trying to generate TypeScript types using the --singular flag.
However, when I use the --singular flag, the tool correctly generates table names in singular form (e.g., user instead of users). Unfortunately, it does not generate enum or column names in singular form. These remain in their plural form (e.g., statuses instead of status).
Actual sample ts file:
exporttypeStatuses="ACTIVE"|"INACTIVE";exportinterfaceUser{// ... other fields.Statuses: Generated<Statuses>;userId: Generated<string>;}
Steps to Reproduce:
Have a PostgreSQL database with an enum type (e.g., statuses).
Use enum type in a table with similar singular name (e.g. status).
CREATETYPEstatusesAS ENUM ('ACTIVE', 'INACTIVE');
CREATETABLEIF NOT EXISTS users (
user_id bigserialPRIMARY KEY,
name text,
status statuses DEFAULT 'ACTIVE'NOT NULL
);
Run the kysely-codegen command with the --singular flag:
enum and column names still remain in plural form.
Expected Behavior:
The --singular flag should apply to all generated types, including enum and column names, ensuring consistency in the naming convention across the generated code.
Actual Behavior:
Only the table names are converted to singular form, while enum and column names remain in plural form.
Kysely Versions:
kysely: 0.27.4
kysely-codegen: 0.17.0
Upvote & Fund
We're using Polar.sh so you can upvote and help fund this issue.
We receive the funding once the issue is completed & confirmed by you.
Thank you in advance for helping prioritize & fund our backlog.
The text was updated successfully, but these errors were encountered:
I am using Kysely's code generation tool for a PostgreSQL database. The database contains an
enum
type forstatuses
, and I am trying to generate TypeScript types using the--singular
flag.However, when I use the
--singular
flag, the tool correctly generates table names in singular form (e.g.,user
instead ofusers
). Unfortunately, it does not generateenum
orcolumn
names in singular form. These remain in their plural form (e.g.,statuses
instead ofstatus
).Actual sample
ts
file:Steps to Reproduce:
--singular
flag:enum
andcolumn
names still remain in plural form.Expected Behavior:
The
--singular
flag should apply to all generated types, includingenum
andcolumn
names, ensuring consistency in the naming convention across the generated code.Actual Behavior:
Only the table names are converted to singular form, while
enum
andcolumn
names remain in plural form.Kysely Versions:
kysely: 0.27.4
kysely-codegen: 0.17.0
Upvote & Fund
The text was updated successfully, but these errors were encountered: