History

Clarify drizzle generator boundaries

Rhys Sullivan committed 6 months ago

Commit 3e9f3d51 parent b039b6e1 file · +3 −1Browse files

Unified · Split

packages/core/cli/src/generators/drizzle.ts+3−1
@@ -38,6 +38,7 @@ const getType = ( · 37 unmodified lines
38 mysql: `mysqlEnum([${type.map((x) => `'${x}'`).join(", ")}])`,38 mysql: `mysqlEnum([${type.map((x) => `'${x}'`).join(", ")}])`,
39 }[dialect];39 }[dialect];
40 }40 }
41 // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: generator rejects invalid schema input through the SchemaGenerator promise API
41 throw new TypeError(42 throw new TypeError(
42 `Invalid field type for field ${name}`,43 `Invalid field type for field ${name}`,
43 );44 );
@@ -95,8 +96,9 @@ const getType = ( · 51 unmodified lines
95 },96 },
96 };97 };
97 98
98 const dbTypeMap = typeMap[type as string];99 const dbTypeMap = typeMap[type];
99 if (!dbTypeMap) {100 if (!dbTypeMap) {
101 // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: generator rejects unsupported schema input through the SchemaGenerator promise API
100 throw new Error(102 throw new Error(
101 `Unsupported field type '${field.type}' for field '${name}'.`,103 `Unsupported field type '${field.type}' for field '${name}'.`,
102 );104 );