Prisma1: Prisma Introspect generates invalid relation names

Created on 21 Feb 2019  路  13Comments  路  Source: prisma/prisma1

Describe the bug
I have introspected a Django PostgreSQL database with Prisma and the datamodel.prisma file that has been generated cannot be deployed because all the @relation names have been generated with underscores _ which makes them invalid.

Shouldn't the introspect command generate valid @relation names?

Any workaround for this?

code

screen shot 2019-02-21 at 5 58 55 pm

bu2-confirmed areintrospection

All 13 comments

@serranoarevalo

Which version of cli are you using?

We recently fixed many of the introspection issues in #4031 so please upgrade to version 1.27 and try again.

If this still an issue please provide a dump of the database which you are using.

@pantharshit00

Hi! I updated and now there are even more and different errors.

You want to see some sample data from the DB or the datamodel.prisma generated by the command?

@serranoarevalo Please share

Also cc @ejoebstl

@pantharshit00 which one?

Both sql dump and the new generated datamodel.

@serranoarevalo

Just noticed that introspection improvements were merged into beta for now.

Can you please try npm i -g prism@beta and try again?

@serranoarevalo

Looks like the generate name is exceeding the character limit.

This will require a fix.

Hello,

thanks for the files @serranoarevalo, very helpful. I was able to reproduce the issue.

It seems like the CLI is printing an unnormalized datamodel. The duplicate fields and relations names which cause issues here should not even be part of the result.

Does this introspection result look better?

I've pushed a fix here.

That eliminates most problems with the current stable server (1.27). The remaining issue right now is that integer IDs are not support.

Thanks a lot for looking into this!

Any ETA for this?

3746

I had raised the same issue before, I hope this fixed soon.

The fix has landed in the stable version.

Please open a new issue if you are still facing this

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marktani picture marktani  路  3Comments

marktani picture marktani  路  3Comments

MitkoTschimev picture MitkoTschimev  路  3Comments

Fi1osof picture Fi1osof  路  3Comments

sorenbs picture sorenbs  路  3Comments