Skip to content

Commit

Permalink
Fixed lack of sql imports on uuid defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
Sukairo-02 committed Aug 8, 2024
1 parent 42fa8a9 commit 1f3d4f8
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "drizzle-prisma-generator",
"author": "Drizzle Team",
"version": "0.1.5",
"version": "0.1.6",
"description": "Generate Drizzle schema from Prisma schema",
"scripts": {
"run": "pnpm run build && cd ../prisma-testbench && npx prisma generate dev && code ./src/db/schema.ts",
Expand Down
2 changes: 2 additions & 0 deletions src/util/generators/mysql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ const addColumnModifiers = (field: DMMF.Field, column: string) => {

if (/^uuid\([0-9]*\)$/.test(value.name)) {
column = column + `.default(sql\`uuid()\`)`;

drizzleImports.add('sql');
break;
}

Expand Down
2 changes: 2 additions & 0 deletions src/util/generators/pg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ const addColumnModifiers = (field: DMMF.Field, column: string) => {

if (/^uuid\([0-9]*\)$/.test(value.name)) {
column = column + `.default(sql\`uuid()\`)`;

drizzleImports.add('sql');
break;
}

Expand Down
2 changes: 2 additions & 0 deletions src/util/generators/sqlite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ const addColumnModifiers = (field: DMMF.Field, column: string) => {

if (/^uuid\([0-9]*\)$/.test(value.name)) {
column = column + `.default(sql\`uuid()\`)`;

drizzleImports.add('sql');
break;
}

Expand Down

0 comments on commit 1f3d4f8

Please sign in to comment.