diff --git a/packages/schema/src/res/stdlib.zmodel b/packages/schema/src/res/stdlib.zmodel index 57cca4f49..dd49d9cc9 100644 --- a/packages/schema/src/res/stdlib.zmodel +++ b/packages/schema/src/res/stdlib.zmodel @@ -189,7 +189,7 @@ attribute @id(map: String?, length: Int?, sort: String?, clustered: Boolean?) @@ /** * Defines a default value for a field. */ -attribute @default(_ value: ContextType) @@@prisma +attribute @default(_ value: ContextType, map: String?) @@@prisma /** * Defines a unique constraint for this field. @@ -261,13 +261,17 @@ attribute @@fulltext(_ fields: FieldReference[]) @@@prisma // String type modifiers +enum MSSQLServerTypes { + Max +} + attribute @db.String(_ x: Int?) @@@targetField([StringField]) @@@prisma attribute @db.Text() @@@targetField([StringField]) @@@prisma attribute @db.NText() @@@targetField([StringField]) @@@prisma attribute @db.Char(_ x: Int) @@@targetField([StringField]) @@@prisma attribute @db.NChar(_ x: Int) @@@targetField([StringField]) @@@prisma -attribute @db.VarChar(_ x: Int) @@@targetField([StringField]) @@@prisma -attribute @db.NVarChar(_ x: Int) @@@targetField([StringField]) @@@prisma +attribute @db.VarChar(_ x: Any) @@@targetField([StringField]) @@@prisma +attribute @db.NVarChar(_ x: Any) @@@targetField([StringField]) @@@prisma attribute @db.CatalogSingleChar() @@@targetField([StringField]) @@@prisma attribute @db.TinyText() @@@targetField([StringField]) @@@prisma attribute @db.MediumText() @@@targetField([StringField]) @@@prisma diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f7305d179..09952fa02 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -124,7 +124,7 @@ importers: version: 0.2.1 ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.22.9)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.5) + version: 29.0.5(@babel/core@7.22.5)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.5) typescript: specifier: ^4.9.5 version: 4.9.5 @@ -747,7 +747,7 @@ importers: version: 29.5.0(@types/node@18.0.0)(ts-node@10.9.1) next: specifier: ^13.4.5 - version: 13.4.5(@babel/core@7.22.5)(react-dom@18.2.0)(react@18.2.0) + version: 13.4.5(@babel/core@7.22.9)(react-dom@18.2.0)(react@18.2.0) rimraf: specifier: ^3.0.2 version: 3.0.2 @@ -756,7 +756,7 @@ importers: version: 6.3.3 ts-jest: specifier: ^29.0.5 - version: 29.0.5(@babel/core@7.22.5)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.4) + version: 29.0.5(@babel/core@7.22.9)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.4) typescript: specifier: ^4.9.4 version: 4.9.4 @@ -8487,7 +8487,7 @@ packages: - babel-plugin-macros dev: true - /next@13.4.5(@babel/core@7.22.5)(react-dom@18.2.0)(react@18.2.0): + /next@13.4.5(@babel/core@7.22.9)(react-dom@18.2.0)(react@18.2.0): resolution: {integrity: sha512-pfNsRLVM9e5Y1/z02VakJRfD6hMQkr24FaN2xc9GbcZDBxoOgiNAViSg5cXwlWCoMhtm4U315D7XYhgOr96Q3Q==} engines: {node: '>=16.8.0'} hasBin: true @@ -8512,7 +8512,7 @@ packages: postcss: 8.4.14 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) - styled-jsx: 5.1.1(@babel/core@7.22.5)(react@18.2.0) + styled-jsx: 5.1.1(@babel/core@7.22.9)(react@18.2.0) watchpack: 2.4.0 zod: 3.21.4 optionalDependencies: @@ -10211,24 +10211,6 @@ packages: react: 18.2.0 dev: true - /styled-jsx@5.1.1(@babel/core@7.22.5)(react@18.2.0): - resolution: {integrity: sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==} - engines: {node: '>= 12.0.0'} - peerDependencies: - '@babel/core': '*' - babel-plugin-macros: '*' - react: '>= 16.8.0 || 17.x.x || ^18.0.0-0' - peerDependenciesMeta: - '@babel/core': - optional: true - babel-plugin-macros: - optional: true - dependencies: - '@babel/core': 7.22.5 - client-only: 0.0.1 - react: 18.2.0 - dev: true - /styled-jsx@5.1.1(@babel/core@7.22.9)(react@18.2.0): resolution: {integrity: sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==} engines: {node: '>= 12.0.0'} @@ -10643,7 +10625,7 @@ packages: yargs-parser: 21.1.1 dev: true - /ts-jest@29.0.5(@babel/core@7.22.5)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.4): + /ts-jest@29.0.5(@babel/core@7.22.5)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.5): resolution: {integrity: sha512-PL3UciSgIpQ7f6XjVOmbi96vmDHUqAyqDr8YxzopDqX3kfgYtX1cuNeBjP+L9sFXi6nzsGGA6R3fP3DDDJyrxA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} hasBin: true @@ -10674,7 +10656,7 @@ packages: lodash.memoize: 4.1.2 make-error: 1.3.6 semver: 7.5.3 - typescript: 4.9.4 + typescript: 4.9.5 yargs-parser: 21.1.1 dev: true @@ -10713,41 +10695,6 @@ packages: yargs-parser: 21.1.1 dev: true - /ts-jest@29.0.5(@babel/core@7.22.9)(esbuild@0.18.13)(jest@29.5.0)(typescript@4.9.5): - resolution: {integrity: sha512-PL3UciSgIpQ7f6XjVOmbi96vmDHUqAyqDr8YxzopDqX3kfgYtX1cuNeBjP+L9sFXi6nzsGGA6R3fP3DDDJyrxA==} - engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} - hasBin: true - peerDependencies: - '@babel/core': '>=7.0.0-beta.0 <8' - '@jest/types': ^29.0.0 - babel-jest: ^29.0.0 - esbuild: '*' - jest: ^29.0.0 - typescript: '>=4.3' - peerDependenciesMeta: - '@babel/core': - optional: true - '@jest/types': - optional: true - babel-jest: - optional: true - esbuild: - optional: true - dependencies: - '@babel/core': 7.22.9 - bs-logger: 0.2.6 - esbuild: 0.18.13 - fast-json-stable-stringify: 2.1.0 - jest: 29.5.0(@types/node@18.0.0)(ts-node@10.9.1) - jest-util: 29.5.0 - json5: 2.2.3 - lodash.memoize: 4.1.2 - make-error: 1.3.6 - semver: 7.5.3 - typescript: 4.9.5 - yargs-parser: 21.1.1 - dev: true - /ts-morph@16.0.0: resolution: {integrity: sha512-jGNF0GVpFj0orFw55LTsQxVYEUOCWBAbR5Ls7fTYE5pQsbW18ssTb/6UXx/GYAEjS+DQTp8VoTw0vqYMiaaQuw==} dependencies: diff --git a/tests/integration/tests/regression/issue-724.test.ts b/tests/integration/tests/regression/issue-724.test.ts new file mode 100644 index 000000000..d660c8281 --- /dev/null +++ b/tests/integration/tests/regression/issue-724.test.ts @@ -0,0 +1,37 @@ +import { loadSchema } from '@zenstackhq/testtools'; + +describe('Regression: issue 724', () => { + it('regression', async () => { + await loadSchema( + ` + generator client { + provider = "prisma-client-js" + } + + datasource db { + provider = "sqlserver" + url = env("DATABASE_URL") + } + + plugin trpc { + provider = '@zenstackhq/trpc' + output = 'src/server/routers/generated' + } + + model LastLocation { + LastLocationID String @id(map: "PK_LastLocation") @db.UniqueIdentifier + UserID String @db.UniqueIdentifier + JobID String? @db.UniqueIdentifier + Timestamp DateTime? @db.DateTime + Latitude String? @db.VarChar(Max) + Longitude String? @db.NVarChar(Max) + MostRecentTimestamp DateTime? @db.DateTime + CreatedDate DateTime @default(now(), map: "DF_Address_CreatedDate") @db.DateTime + + @@index([UserID], map: "IX_UserID") + } + `, + { addPrelude: false, pushDb: false } + ); + }); +});