cli
cli copied to clipboard
Generating types not working for enums: Field name 'request_status' works fine in the UI, but when the types are generated, it uses other values ("PENDING" | "SUCCESS" | "ERROR")
Bug report
- [ X ] I confirm this is a bug with Supabase, not with my own application.
- [ X ] I confirm I have searched the Docs, GitHub Discussions, and Discord.
Describe the bug
Field name 'request_status' works fine in the UI, but when the types are generated, it uses other values ("PENDING" | "SUCCESS" | "ERROR")
To Reproduce
In a Nuxt app with supabase, I created 2 enum types as such, then when generating the types, I get statusA: "PENDING" | "SUCCESS" | "ERROR"
for toto_bug
instead of the correct statusA: Database["public"]["Enums"]["my_custom_status"]
for toto_fine
. But it works as expected for both tables in the UI editor (I can use 'approved' for instance).
CREATE TYPE "public"."request_status" AS ENUM (
'pending',
'approved',
'refused',
'cancelled'
);
CREATE TABLE IF NOT EXISTS "public"."toto_bug" (
"id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
"statusP" "public"."request_status" DEFAULT 'pending'::"public"."request_status" NOT NULL,
"statusA" "public"."request_status" DEFAULT 'approved'::"public"."request_status" NOT NULL,
"statusR" "public"."request_status" DEFAULT 'refused'::"public"."request_status" NOT NULL,
"statusC" "public"."request_status" DEFAULT 'cancelled'::"public"."request_status" NOT NULL
);
CREATE TYPE "public"."my_custom_status" AS ENUM (
'pending',
'approved',
'refused',
'cancelled'
);
CREATE TABLE IF NOT EXISTS "public"."toto_fine" (
"id" "uuid" DEFAULT "gen_random_uuid"() NOT NULL,
"statusP" "public"."my_custom_status" DEFAULT 'pending'::"public"."my_custom_status" NOT NULL,
"statusA" "public"."my_custom_status" DEFAULT 'approved'::"public"."my_custom_status" NOT NULL,
"statusR" "public"."my_custom_status" DEFAULT 'refused'::"public"."my_custom_status" NOT NULL,
"statusC" "public"."my_custom_status" DEFAULT 'cancelled'::"public"."my_custom_status" NOT NULL
);
Expected behavior
A clear and concise description of what you expected to happen.
Screenshots
System information
- OS: macOS
- Browser (if applies) [e.g. chrome, safari]
- Version of supabase (CLI): 1.106.1
- @nuxtjs/supabase: 1.1.3
- Version of Node.js: v18.18.2
Additional context
Add any other context about the problem here.
Guessing it has to do with this? I'm thinking it is clashing somehow.
https://github.com/supabase/pg_net/blob/master/sql/pg_net.sql#L259