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

Doesn't map after first table #18

Closed
shellscape opened this issue Apr 8, 2023 · 7 comments
Closed

Doesn't map after first table #18

shellscape opened this issue Apr 8, 2023 · 7 comments

Comments

@shellscape
Copy link

Running the tool with prisma-case-format --file prisma/schema.prisma --pluralize it doesn't map after the first table. Here's the source prisma schema:

generator client {
  provider        = "prisma-client-js"
  output          = "../node_modules/@generated/read"
  previewFeatures = ["views"]
}

generator typegraphql {
  provider = "typegraphql-prisma"
}

datasource db {
  provider = "postgres"
  url      = env("DB_URL")
}

model goose_db_version {
  id         Int       @id @default(autoincrement())
  version_id BigInt
  is_applied Boolean
  tstamp     DateTime? @default(now()) @db.Timestamp(6)
}

view accounts {
  id         String    @unique @db.Uuid
  created_at DateTime? @db.Timestamp(6)
  name       String?
  updated_at DateTime? @db.Timestamp(6)
  owned_by   String?   @db.Uuid
  users      users?
}

And the result of a dry run (which also matches running normally)

generator client {
  provider        = "prisma-client-js"
  output          = "../node_modules/@generated/read"
  previewFeatures = ["views"]
}

generator typegraphql {
  provider = "typegraphql-prisma"
}

datasource db {
  provider = "postgres"
  url      = env("DB_URL")
}

model GooseDbVersion {
  id        Int       @id @default(autoincrement())
  versionId BigInt    @map("version_id")
  isApplied Boolean   @map("is_applied")
  tstamp    DateTime? @default(now()) @db.Timestamp(6)

  @@map("goose_db_version")
}

view accounts {
id         String    @unique @db.Uuid
created_at DateTime? @db.Timestamp(6)
name       String?
updated_at DateTime? @db.Timestamp(6)
owned_by   String?   @db.Uuid
users      users?
}

You can see from the output above that after goose_db_version the tool ceases to convert.

@iiian
Copy link
Owner

iiian commented Apr 8, 2023

Hey @shellscape. IIRC views are a relatively new feature in Prisma, so this tool doesn't support them yet. It looks like there are mounting feature requests so I'm trying to take care of them this weekend. Will keep you posted.

@shellscape
Copy link
Author

Thanks for the quick reply. If you don't have the opportunity I'll probably be able to get add that capability this next week.

@iiian
Copy link
Owner

iiian commented Apr 8, 2023

@shellscape, if you take a look at https://github.com/iiian/prisma-case-format/pull/20/files#diff-390b3178f6c849ab73dd0194ed9c880eb7073d0f00ea0f872cd0f3c2af6513f8R592, does this jest snapshot match your expectations for the output based on the example schema you provided?

@shellscape
Copy link
Author

Yeah that looks about right to me.

@iiian
Copy link
Owner

iiian commented Apr 8, 2023

I've released v1.4.0-beta.0 https://www.npmjs.com/package/prisma-case-format/v/1.4.0-beta.0?activeTab=readme. Please give it a shot and let me know how it works out for you!

@shellscape
Copy link
Author

Much appreciated. Will do my best to try it tonight

@shellscape
Copy link
Author

Just gave it a try and it looks beautiful. Thanks for getting that in.

@iiian iiian closed this as completed Apr 11, 2023
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

No branches or pull requests

2 participants