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

Removal of undocumented support for type alias with Prisma 4.0.0 #9939

Closed
pimeys opened this issue Oct 25, 2021 · 13 comments · Fixed by prisma/prisma-engines#2942
Closed

Removal of undocumented support for type alias with Prisma 4.0.0 #9939

pimeys opened this issue Oct 25, 2021 · 13 comments · Fixed by prisma/prisma-engines#2942
Assignees
Labels
Milestone

Comments

@pimeys
Copy link
Contributor

pimeys commented Oct 25, 2021

With the release of Prisma 3.7.0 the VSCode extension (and other IDEs using our language server implementation) will start to show a warning when we detecting unsupported usage of the type keyword.

An example of that is string aliases such as:

type MyId = String @id @default(dbgenerated(new_uuid()))
model A {
  id MyId
}

We plan to remove that functionality entirely with the next major release of Prisma. If you happen to depend on similar functionality for string aliasing, please leave a comment.

Thank you!

@pimeys pimeys added kind/bug A reported bug. kind/feedback Issue for gathering feedback. and removed kind/bug A reported bug. labels Oct 25, 2021
@pimeys pimeys changed the title Foo Is anybody using type aliases? Oct 25, 2021
@matthewmueller

This comment has been minimized.

@pimeys

This comment has been minimized.

@pimeys
Copy link
Contributor Author

pimeys commented Oct 25, 2021

We will trigger a warning for our users who happen to use them in their code, so we can ask some questions and maybe decide on actually doing a real implementation with docs and such.

@janpio janpio added the team/schema Issue for team Schema. label Nov 2, 2021
@floelhoeffel floelhoeffel changed the title Is anybody using type aliases? Removal of undocumented support for "type" alias with Prisma 4.0.0 Dec 20, 2021
@Jolg42
Copy link
Member

Jolg42 commented Dec 20, 2021

This is an example of a warning from the VS Code extension that will be shipped in 3.7.0
image

@jycouet
Copy link

jycouet commented Dec 21, 2021

Any plans to have an other way to do:

type MyId = String @id @default(dbgenerated(new_uuid()))

Something like?

alias MyId = String @id @default(dbgenerated(new_uuid()))

@janpio
Copy link
Member

janpio commented Dec 21, 2021

We have a related issue @jycouet: #5039 Does that fully match what you are asking for? If not, feel free to open a new feature request issue - that sounds like a reasonable suggestion. (Are you currently using the old type?)

@jycouet
Copy link

jycouet commented Dec 21, 2021

Yes, #5039 is maching what I have in mind. thx.
I'm not using old type. I saw it today that it's deprecated now. It seemed to be a so nice thing to do.

@JonathanWilbur
Copy link

I'm not totally opposed to removing it if there's a suitable alternative, but, why are we removing this? This seems like a perfectly useful feature. Is it doing any harm by being there?

Here is an example of where I use it:

// Period-delimited numeric-only object identifiers.
type OIDs = String

It might seem trivial, but being able to alias types like this makes my schema more self-documenting. I'd like to continue using this, or something that can at least currently provide this functionality.

@pimeys
Copy link
Contributor Author

pimeys commented Dec 24, 2021

A few reasons:

  • It was never documented
  • We inherited it from Prisma 1
  • It is almost completely not tested anywhere
  • And it is quite broken with certain use-cases
  • It is not very thoroughly designed, there are weird edge cases

What we should do is to design something proper, test it and discuss it. Then finally document it. I think a new keyword alias would be a good idea, if people think they have uses for it.

@JonathanWilbur
Copy link

Okay, thank you for clearing that up. I do think alias would be a more technically-correct word for this.

@janpio janpio changed the title Removal of undocumented support for "type" alias with Prisma 4.0.0 Removal of undocumented support for type alias with Prisma 4.0.0 Apr 13, 2022
@maxh
Copy link

maxh commented May 6, 2022

For what it's worth, my team had been planning use type aliases to work around date and datetime limitations in Prisma: #4355 (comment)

Looks like we might need to rely on our own comments or parsing on top of the Prisma schema to get the desired behavior.

@janpio
Copy link
Member

janpio commented May 6, 2022

Yeah, sorry about that - but those were only partially implemented anyway so I would not have been surprised if you hit a nasty limit or edge case somewhere. Have a look at #5039 if this would help with your problem, we see this as the better re-implementation of what this could have been.

@Jolg42 Jolg42 added this to the 4.x milestone May 9, 2022
@maxh
Copy link

maxh commented May 9, 2022

Have a look at #5039 if this would help with your problem

Yes, that is exactly what we need. I see now that you mentioned it above as well. We'll stay (eagerly) tuned for that -- thanks for an otherwise amazing tool!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants