Prisma1: Relations not created for nested nodes when seeding

Created on 27 Feb 2018  路  6Comments  路  Source: prisma/prisma1

Bug Report

Current behavior

When deploying a fresh Prisma service along with a seed file, the nodes seem to be created, but not the relations between them.

Reproduction

The datamodel.graphql file

type Calendar {
  id: ID! @unique
  name: String!

  bookings: [Booking!]!
}

type Booking {
  id: ID! @unique
  totalPrice: Int!

  calendar: Calendar!
}

The seed.graphql file

mutation {
  firstCalendar: createCalendar(
    data: {
      name: "Bob's Calendar"
      bookings: {
        create: [{
          totalPrice: 9900
        }]
      }
    }
  ) { id }
}

Expected behavior?

When testing in GraphQL playground, I can see the nodes created, but not the relations.

screen shot 2018-02-27 at 17 26 25

bu2-confirmed bu0-needs-info

Most helpful comment

Hey @marktani, when I run the same mutation in the https://eu1.prisma.sh/kuldar/MY-APP/dev playground, things seem to work and nodes are created with correct relations.

screen shot 2018-02-27 at 19 45 50
screen shot 2018-02-27 at 19 46 27

All 6 comments

Hey @kuldar, thanks for reporting this problem.

When running the mutation yourself against the API, do you observe the expected behaviour?

Hey @marktani, when I run the same mutation in the https://eu1.prisma.sh/kuldar/MY-APP/dev playground, things seem to work and nodes are created with correct relations.

screen shot 2018-02-27 at 19 45 50
screen shot 2018-02-27 at 19 46 27

Hey @kuldar, can you please describe how you are using seed.graphql exactly? Are you using the seed property in prisma.yml? What steps are you taking then exactly?

Yes, @marktani I imported it through prisma.yml

seed:
  import: seed.graphql

I then made sure to delete the deployment and initiate the seeding again with prisma deploy.

The issue seems to have been fixed by recent changes.

bildschirmfoto 2018-04-08 um 19 45 51

I am facing this issue even with 1.8.2 and 1.8.3 I am using an exported NDF zip file in seed and I anticipate the following query to show versions (a post can have many versions in this system)!

query Posts {
  allPosts {
    id
    version {
      id
      title_en
    }
  }
}

but it returns empty array for versions i.e. relations are not created.

Interestingly, this only happens with seeding while prisma deploy using prisma import --data <path> or prisma seed on a fresh empty cluster works fine.

Also, prisma version

divyendusingh [prisma-backend]$ prisma --version
prisma/1.8.3 (darwin-x64) node-v8.4.0

Please let me know how else can I help in triaging this.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fi1osof picture Fi1osof  路  3Comments

marktani picture marktani  路  3Comments

schickling picture schickling  路  3Comments

MitkoTschimev picture MitkoTschimev  路  3Comments

marktani picture marktani  路  3Comments