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

No output #59

Open
n00el opened this issue Mar 7, 2024 · 1 comment · May be fixed by #71
Open

No output #59

n00el opened this issue Mar 7, 2024 · 1 comment · May be fixed by #71

Comments

@n00el
Copy link

n00el commented Mar 7, 2024

The generate function runs successfully, but there is no output file....

Version:
"prisma-class-generator": "^0.2.9",

schema.prisma:

generator client {
  provider = "prisma-client-js"
}

generator prismaClassGenerator {
  provider = "prisma-class-generator"
}

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

model User {
  id    Int     @id @default(autoincrement())
  email String  @unique
  name  String?
  posts Post[]
}

model Post {
  id        Int      @id @default(autoincrement())
  title     String
  content   String?
  published Boolean? @default(false)
  author    User?    @relation(fields: [authorId], references: [id])
  authorId  Int?
}

npx prisma generate output:

Environment variables loaded from .env
Prisma schema loaded from prisma\schema.prisma
prisma:info [Prisma Class Generator]:Handler Registered.
prisma:info [Prisma Class Generator]:[dryRun] Generate C:\Users\Noel\Documents\source\vesta-new\vesta-nestjs\src\_gen\prisma-class\user.ts
import { Post } from './post';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class User {
        @ApiProperty({ type: Number })
        id: number;

        @ApiProperty({ type: String })
        email: string;

        @ApiPropertyOptional({ type: String })
        name?: string;

        @ApiProperty({ isArray: true, type: () => Post })
        posts: Post[];
}

prisma:info [Prisma Class Generator]:[dryRun] Generate C:\Users\Noel\Documents\source\vesta-new\vesta-nestjs\src\_gen\prisma-class\post.ts
import { User } from './user';
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';

export class Post {
        @ApiProperty({ type: Number })
        id: number;

        @ApiProperty({ type: String })
        title: string;

        @ApiPropertyOptional({ type: String })
        content?: string;

        @ApiPropertyOptional({ type: Boolean })
        published?: boolean;

        @ApiPropertyOptional({ type: () => User })
        author?: User;

        @ApiPropertyOptional({ type: Number })
        authorId?: number;
}

prisma:info [Prisma Class Generator]:[dryRun] Generate C:\Users\Noel\Documents\source\vesta-new\vesta-nestjs\src\_gen\prisma-class\index.ts
import { User as _User } from './user';
import { Post as _Post } from './post';

export namespace PrismaModel {
        export class User extends _User {}
        export class Post extends _Post {}

        export const extraModels = [User, Post];
}


✔ Generated Prisma Client (v5.10.2) to .\node_modules\@prisma\client in 67ms

✔ Generated Prisma Class Generator to .\src\_gen\prisma-class in 80ms
@n00el
Copy link
Author

n00el commented Mar 7, 2024

Omg I found it, you need dryRun=false, since its true by default.. Maybe update the tutorial to include this?..

output = "../src/_gen/prisma-class"
dryRun = "false"
separateRelationFields = "false"

gylove1994 pushed a commit to gylove1994/prisma-class-generator that referenced this issue Aug 23, 2024
@gylove1994 gylove1994 linked a pull request Aug 23, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant