Entsllor
Entsllor
DTDrizzle Team
Created by Entsllor on 5/2/2024 in #help
[BUG?] Handling Postgresql schemas when using enums
"drizzle-orm": "^0.30.10" Hello. I have a simple table with a status column
export const BaseSchema = pgSchema(settings.DB_SCHEMA_NAME); // DB_SCHEMA_NAME=my_schema
export const statusEnum = BaseSchema.enum("version_status", values);

export const versions = BaseSchema.table("versions", {
status: statusEnum("status").default(VersionStatus.draft),
// ...rest columns
});
export const BaseSchema = pgSchema(settings.DB_SCHEMA_NAME); // DB_SCHEMA_NAME=my_schema
export const statusEnum = BaseSchema.enum("version_status", values);

export const versions = BaseSchema.table("versions", {
status: statusEnum("status").default(VersionStatus.draft),
// ...rest columns
});
When I generate new migration I get this
CREATE TYPE "version_status" AS ENUM('draft', 'published', 'inactive');
CREATE TYPE "version_status" AS ENUM('draft', 'published', 'inactive');
But it does not consider DB_SCHEMA_NAME, and this type will be stored in public.object types instead of my_schema.object types I expect something like this:
CREATE TYPE "my_schema"."version_status" AS ENUM('draft', 'published', 'inactive');
CREATE TYPE "my_schema"."version_status" AS ENUM('draft', 'published', 'inactive');
2 replies