Database diagrams editor that allows you to visualize and design your DB with a single query.
TypeScript databasedbdb-migrationeditorerdmariadbmssqlmysqlpostgresqlreactreact-flowschema-migrationssqlsqlitetypescriptvisualizationxyflow
fix(custom-types): Make schema optional (#866)
Aaron Dewes60c5675cbfe2
diff --git a/src/lib/domain/db-custom-type.ts b/src/lib/domain/db-custom-type.tsindex e43e4c39..59a00679 100644--- a/src/lib/domain/db-custom-type.ts+++ b/src/lib/domain/db-custom-type.ts@@ -15,12 +15,12 @@ export interface DBCustomTypeField {export interface DBCustomType {id: string;- schema?: string;+ schema?: string | null;name: string;kind: DBCustomTypeKind;- values?: string[]; // For enum types- fields?: DBCustomTypeField[]; // For composite types- order?: number;+ values?: string[] | null; // For enum types+ fields?: DBCustomTypeField[] | null; // For composite types+ order?: number | null;}export const dbCustomTypeFieldSchema = z.object({@@ -30,11 +30,12 @@ export const dbCustomTypeFieldSchema = z.object({export const dbCustomTypeSchema: z.ZodType<DBCustomType> = z.object({id: z.string(),- schema: z.string(),+ schema: z.string().or(z.null()).optional(),name: z.string(),kind: z.nativeEnum(DBCustomTypeKind),- values: z.array(z.string()).optional(),- fields: z.array(dbCustomTypeFieldSchema).optional(),+ values: z.array(z.string()).or(z.null()).optional(),+ fields: z.array(dbCustomTypeFieldSchema).or(z.null()).optional(),+ order: z.number().or(z.null()).optional(),});export const createCustomTypesFromMetadata = ({diff --git a/src/pages/editor-page/side-panel/custom-types-section/custom-type-list/custom-type-list.tsx b/src/pages/editor-page/side-panel/custom-types-section/custom-type-list/custom-type-list.tsxindex 2899397e..bdcf4be1 100644--- a/src/pages/editor-page/side-panel/custom-types-section/custom-type-list/custom-type-list.tsx+++ b/src/pages/editor-page/side-panel/custom-types-section/custom-type-list/custom-type-list.tsx@@ -128,8 +128,8 @@ export const CustomTypeList: React.FC<CustomTypeProps> = ({ customTypes }) => {// if both have order, sort by orderif (- customType1.order !== undefined &&- customType2.order !== undefined+ customType1.order != null &&+ customType2.order != null) {return (customType1.order - customType2.order