When using pgEnum, it won't work with xata when trying to push the schema because of this error
error: unsupported statement [DO] on regular level, see https://xata.io/sql-support for the support matrix
at F:\Typescript\Personal Web\Personal-Web\node_modules\.pnpm\drizzle-kit@0.21.4\node_modules\drizzle-kit\bin.cjs:69429:15
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.query (F:\Typescript\Personal Web\Personal-Web\node_modules\.pnpm\drizzle-kit@0.21.4\node_modules\drizzle-kit\bin.cjs:111366:26)
at async pgPush (F:\Typescript\Personal Web\Personal-Web\node_modules\.pnpm\drizzle-kit@0.21.4\node_modules\drizzle-kit\bin.cjs:114524:13)
at async Command.<anonymous> (F:\Typescript\Personal Web\Personal-Web\node_modules\.pnpm\drizzle-kit@0.21.4\node_modules\drizzle-kit\bin.cjs:121480:7) {
length: 106,
severity: undefined,
code: undefined,
detail: undefined,
hint: undefined,
position: undefined,
internalPosition: undefined,
internalQuery: undefined,
where: undefined,
schema: undefined,
table: undefined,
column: undefined,
dataType: undefined,
constraint: undefined,
file: undefined,
line: undefined,
routine: undefined
}
is enum just not possible to be used when using the beta postgres from xata?
i tried using the raw query in the xata web playground using the sql code that you get from doing generateand it seems that enum actually works but i needed to remove the do statement and also the public in the type.
Expected behavior
i expect it to work without error. I have also tried my schema in local postgres and it works fine.
DO $$ BEGIN
CREATE TYPE "public"."visibility" AS ENUM('draft', 'private', 'published');
EXCEPTION
WHEN duplicate_object THEN null;
END $$;
CREATE TABLE IF NOT EXISTS "blog" (
"id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
"description" text NOT NULL,
"content" json NOT NULL,
"visibility" "visibility" DEFAULT 'draft',
);
What version of
drizzle-orm
are you using?0.30.10
What version of
drizzle-kit
are you using?0.21.4
Describe the Bug
When using pgEnum, it won't work with xata when trying to push the schema because of this error
is enum just not possible to be used when using the beta postgres from xata?i tried using the raw query in the xata web playground using the sql code that you get from doing
generate
and it seems that enum actually works but i needed to remove thedo
statement and also thepublic
in the type.Expected behavior
i expect it to work without error. I have also tried my schema in local postgres and it works fine.
Environment & setup
Here is my drizzle config
The enum usage example:
The verbose output