Updated GraphQL schema changes not reflected in playground/fauna system

I tried to update my graphql schema from:

type MonthlyPropertyRoom {
  revenue: MonthlyPropertyRoomRevenue
}
type MonthlyPropertyRoomRevenue @embedded {
  rentPayment: Long
}

to

type MonthlyPropertyRoom {
  revenue: [MonthlyPropertyRoomRevenue!] @relation
}
type MonthlyPropertyRoomRevenue {
  room: MonthlyPropertyRoom! @relation
}

And the fauna dashboard claimed to have updated the graphql schema, but the schema update isn’t reflected in the graphql playground. It created the MonthlyPropertyRoomRevenue collection and the proper index in the DB for me however.

Any ideas of how to get it to work without losing data?

@wallslide are you referring to the SCHEMA tab in playground or the ability to run below new query/mutations on existing data ? I think it is later but want to confirm.

Schema update from @embedded directive to @relation directive does not trigger any data migration from existing collection MonthlyPropertyRoom to new collection MonthlyPropertyRoomRevenue.

You could probably write a custom script to

  1. Read revenue from each MonthlyPropertyRoom document
  2. Create a corresponding MonthlyPropertyRoomRevenue document.
  3. Use connect to relate them.

I’m referring to the DOCS/SCHEMA tabs and the auto-completion in the playground. The MonthlyPropertyRoom.revenue field is still being treated like it’s an embedded object:

query {
  findMonthlyPropertyRoomByID(id:"255880979838665235"){
    revenue {
      rentPayment
    }
  }
}

instead of a one-to-many relation like:

query {
  findMonthlyPropertyRoomByID(id:"255880979838665235"){
    revenue {
      data {
         rentPayment
      }
    }
  }
}

Thanks for sharing that. Schema changes are in the database and SCHEMA tab but the query pane is still using the old schema. Looks like a bug. Will troubleshoot more and update.

1 Like