diff --git a/package.json b/package.json index 791eb10..a1ee9ca 100755 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/util/generators/mysql.ts b/src/util/generators/mysql.ts index 375b659..b5a216b 100755 --- a/src/util/generators/mysql.ts +++ b/src/util/generators/mysql.ts @@ -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; } diff --git a/src/util/generators/pg.ts b/src/util/generators/pg.ts index e4c8498..1042fb7 100755 --- a/src/util/generators/pg.ts +++ b/src/util/generators/pg.ts @@ -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; } diff --git a/src/util/generators/sqlite.ts b/src/util/generators/sqlite.ts index b4f388e..0aeb2c8 100755 --- a/src/util/generators/sqlite.ts +++ b/src/util/generators/sqlite.ts @@ -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; }