Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@ignore causes TypeScript compilation error due to missing upsert methods #64

Open
amiran-gorgazjan opened this issue Feb 13, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@amiran-gorgazjan
Copy link

Bug description

If a model has an @ignore tag, the prisma-trpc-generator will (I'm assuming correctly) not output the upsert and createOne methods for User, but at the same time will still import the schemas which now don't exist and cause a compilation error.

How to reproduce

Given a schema

model User {
  id       Int     @id @default(autoincrement())
  email    String  @unique
  name     String?
  password String  @ignore
}

You should get the compilation error:

// generated/routers/User.router.ts
import { t, publicProcedure } from "./helpers/createRouter";
import { UserFindUniqueSchema } from "../schemas/findUniqueUser.schema";
import { UserFindFirstSchema } from "../schemas/findFirstUser.schema";
import { UserFindManySchema } from "../schemas/findManyUser.schema";
import { UserCreateOneSchema } from "../schemas/createOneUser.schema"; // Cannot find module
import { UserDeleteOneSchema } from "../schemas/deleteOneUser.schema";
import { UserUpdateOneSchema } from "../schemas/updateOneUser.schema";
import { UserDeleteManySchema } from "../schemas/deleteManyUser.schema";
import { UserUpdateManySchema } from "../schemas/updateManyUser.schema";
import { UserUpsertSchema } from "../schemas/upsertOneUser.schema"; // Cannot find module
import { UserAggregateSchema } from "../schemas/aggregateUser.schema";
import { UserGroupBySchema } from "../schemas/groupByUser.schema";

Expected behavior

import { UserUpsertSchema } from "../schemas/upsertOneUser.schema";

and

import { UserCreateOneSchema } from "../schemas/createOneUser.schema";

Should not be present in the User.router.ts file

Prisma information

model User {
  id       Int     @id @default(autoincrement())
  email    String  @unique
  name     String?
  password String  @ignore
}

Environment & setup

N/A

Prisma Version

4.10.1
@omar-dulaimi omar-dulaimi added the bug Something isn't working label Feb 18, 2023
@omar-dulaimi
Copy link
Owner

Hey, could you share your db block in the Prisma schema file?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants