Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--runtime-enums not working as expected #152

Open
avermeil opened this issue Apr 29, 2024 · 0 comments
Open

--runtime-enums not working as expected #152

avermeil opened this issue Apr 29, 2024 · 0 comments

Comments

@avermeil
Copy link

avermeil commented Apr 29, 2024

Hello!

I believe that there is an issue with the --runtime-enums flag.

Given this mysql table definition:

CREATE TABLE `campaign_attributes` (
  `opt_account_id` varchar(30) NOT NULL,
  `id` bigint unsigned NOT NULL,
  `name` varchar(250) DEFAULT NULL,
  `status` enum('ENABLED','PAUSED','REMOVED','ENABLED_NOT_SERVING','UNKNOWN') NOT NULL,
  PRIMARY KEY (`opt_account_id`,`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
/*!50100 PARTITION BY KEY (opt_account_id)
PARTITIONS 100 */;

And this command:

kysely-codegen --runtime-enums --camel-case --dialect mysql --url 'mysql://db/warehouse?user=user&password=password'

I get the output:

export interface CampaignAttributes {
  id: number;
  name: string | null;
  optAccountId: string;
  status: "ENABLED" | "ENABLED_NOT_SERVING" | "PAUSED" | "REMOVED" | "UNKNOWN";
}

This is with kysely-codegen@0.15.0.

Shouldn't the output be using enums instead of strings for the field status?

Thanks for any help :)

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.
Fund with Polar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant