Prisma1: Prisma Deploy failed

Created on 2 Oct 2018  Â·  5Comments  Â·  Source: prisma/prisma1

datamodel-old.prisma.zip
For the data model attached I am getting following errors when I am trying to do prisma deploy.

Errors:

Alert_offer
✖ The required field id is missing and has to have the format: id: ID! @unique or id: UUID! @unique or id: Int! @unique.

Checkout_order_offer
✖ The required field id is missing and has to have the format: id: ID! @unique or id: UUID! @unique or id: Int! @unique.

Slowmoving
✖ The required field id is missing and has to have the format: id: ID! @unique or id: UUID! @unique or id: Int! @unique.

Storemasteroffer
✖ The required field id is missing and has to have the format: id: ID! @unique or id: UUID! @unique or id: Int! @unique.

Tagproduct
✖ The required field id is missing and has to have the format: id: ID! @unique or id: UUID! @unique or id: Int! @unique.

Checkoutorder
✖ The relation field payment must specify a @relation directive: @relation(name: "MyRelation")
✖ The relation field payments must specify a @relation directive: @relation(name: "MyRelation")

Payment
✖ The relation field checkoutorder must specify a @relation directive: @relation(name: "MyRelation")
✖ The relation field checkoutorders must specify a @relation directive: @relation(name: "MyRelation")

bu1-repro-available statustale

Most helpful comment

Yeah it does . I got my errors resolved by putting id field in all tables . It does work well if the application was started with Prisma . But if I am using your feature to generate graphql files for existing database it does make it weird because not all tables should have an "id" field . Lets say I am having many to many relationship between a and b which will force me to create an association table with primary_key of "a" and primary key of "b" and they together act as a primary key for the association which makes having one more column with id redundant .

The post does specify the limitations of current Prisma module . But I hope you guys would soon make it robust and fix the current limitations with Prisma .

If I am not wrong the support for using Prisma existing database is in beta . When can I expect a stable release ?

All 5 comments

I did see the validation Code
prisma/server/servers/deploy/src/test/scala/com/prisma/deploy/migration/validation/SchemaSyntaxValidatorSpec.scala

and I am suspecting the below validation is what my model is failing.

"fail if a model does not specify an id field at all for a passive connector" in {
    val schema =
      """
        |type Todo {
        |  title: String
        |}
      """.stripMargin
    val result = SchemaSyntaxValidator(schema, isActive = false).validate
    val error1 = result.head
    error1.`type` should equal("Todo")
    error1.field should equal(Some("id"))
    error1.description should include(
      s"The required field `id` is missing and has to have the format: id: ID! @unique or id: UUID! @unique or id: Int! @unique.")
  }

What is passive connector ?

Hi @shashankn91, this is actually a current limitation of the "passive Postgres connector".

What is passive connector ?

This is the current terminology to talk about a Prisma database connector that uses introspection to automatically generate the datamodel. In constrast to "active connectors" who use the datamodel you create to determine the database schema.

Anyway, I'm quoting the current limitations of the passive Postgres connector:

Model types must always have an id field. If the name in the schema diverges use the pgColumn directive: id: Int! @unique @pgColumn(name: "my_id_column")

Does this help in your case?

Yeah it does . I got my errors resolved by putting id field in all tables . It does work well if the application was started with Prisma . But if I am using your feature to generate graphql files for existing database it does make it weird because not all tables should have an "id" field . Lets say I am having many to many relationship between a and b which will force me to create an association table with primary_key of "a" and primary key of "b" and they together act as a primary key for the association which makes having one more column with id redundant .

The post does specify the limitations of current Prisma module . But I hope you guys would soon make it robust and fix the current limitations with Prisma .

If I am not wrong the support for using Prisma existing database is in beta . When can I expect a stable release ?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 10 days if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

schickling picture schickling  Â·  3Comments

hoodsy picture hoodsy  Â·  3Comments

jannone picture jannone  Â·  3Comments

ragnorc picture ragnorc  Â·  3Comments

marktani picture marktani  Â·  3Comments