Prisma-client-js: Remove Aggregate as reserved word

Created on 6 Aug 2020  路  10Comments  路  Source: prisma/prisma-client-js

Why is AggregateBalance a reserved name for models?

image

kinimprovement tecengines prisma-client reserved words

Most helpful comment

Ah, just looked at the Rust list.
We will look into if it is possible to remove this reserved name (as with many others).

All 10 comments

@cyrus-za
Because if you create a model named Balance, theprisma client will try to generate an AggregateBalance type for aggregateApi which will conflict with AggregateBalance model.

Thanks. Just a little strange

Valid concern and we will see if we can find a way around this in some way.

@WellFail "Aggregate" is not actually on that list though, right?

@janpio
https://github.com/prisma/prisma/blob/c36c1a7a84a5be3fd12522870a2f48cabdb6b833/src/packages/client/src/generation/generateClient.ts#L615
Aggregate currently on this list and I see Aggregate${modelName} type in my generated prisma client.

The main problem is - If we have model AggregateBalance and Balance, prisma will generate AggregateAggregateBalance, AggregateBalance types for aggregation API and generate Balance type and AggregateBalance type for the base model type. These types will be conflicted with each other.

Maybe we can generate $Aggregate{name} types if there only this problem?

Yes, I can confirm this and the writeup @WellFail did is correct. We will need to prefix them as did for ${name}Client.

Ah, just looked at the Rust list.
We will look into if it is possible to remove this reserved name (as with many others).

Thanks, please tag me when this is fixed so I can switch my model name back

No promises this will happen any time soon - but it is a general thing we are trying to do.

This is fixed in the latest dev version - 2.12.0-dev.19 and will be shipped on latest next week Tuesday in our 2.12.0 release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

divyenduz picture divyenduz  路  3Comments

FluorescentHallucinogen picture FluorescentHallucinogen  路  3Comments

esistgut picture esistgut  路  4Comments

timsuchanek picture timsuchanek  路  4Comments

MichalLytek picture MichalLytek  路  3Comments