Transferring Data from Graph Cool Cloud to Prisma Cloud

framework
prisma

#1

Hey!

I have 2 services running on graph cool cloud which I would like to shift to prisma cloud.

service 1: It is not upgraded i.e schema is editable directly from console and not the CLI. It also has around 1000 files hosted on it.

service 2: It is upgraded and workable with the CLI

I have created new working and updated services for both of these on prisma cloud and all that is left is transferring the data.

What would be the best way to achieve that?

Thanks alot for your help!


#2

Hey @ragzor,

let me describe the process on export data from Graphcool Framework into Prisma services. This works for legacy Console projects, as well as Graphcool Framework projects that are managed from the CLI.

Export data from Graphcool Framework and legacy Console projects

Let’s say your project id is ciou24pc4181801rxgum2c9ca, and it’s hosted in the region eu-west-1.

  • Create a new folder, with a file called .graphcoolrc. This is how the file needs to look like:

    targets:
      prod: shared-eu-west-1/ciou24pc4181801rxgum2c9ca
      default: prod
    

    Note: other regions include shared-us-east-2 and shared-ap-northeast-1.

  • Install the latest version of the Graphcool Framework CLI: npm install -g graphcool

  • In that folder, run graphcool export -e export.zip.
    Note: make sure that your IP is close to the region of the project. If needed, setup a VPN to ensure being closer to the right region than to the other two regions. This is due to the problem described here. For Graphcool Framework projects, the .graphcoolrc file gives you insights into the project’s region. If you require this information for your legacy Console project, please reach out to support@graph.cool.

Now we should have an export.zip with our data.

Prepare Prisma Service

We need to create a new Prisma service with the equivalent data model. As the data modelling capabilities in Prisma are more powerful, we only need to do minor cosmetic adjustments here.

Example Graphcool Framework datamodel:

type User @model {
  id: ID! @isUnique
  name: String!
  interests: [String!]!
  age: Int
  posts: [Post!]! @relation(name: "UserPosts")
  location: Location @relation(name: "UserLocation")
}

type Post @model {
  id: ID! @isUnique
  title: String!
  category: Category!
  author: User! @relation(name: "UserPosts")
}

type Location @model {
  id: ID! @isUnique
  lat: Float!
  lng: Float!
  user: User @relation(name: "UserLocation")
}

enum Category {
  TUTORIAL,
  ANNOUNCEMENT,
  NEWS
}

Equivalent Prisma datamodel:

type User {
  id: ID! @unique
  name: String!
  interests: [String!]!
  age: Int
  posts: [Post!]! @relation(name: "UserPosts")
  location: Location @relation(name: "UserLocation")
}

type Post {
  id: ID! @unique
  title: String!
  category: Category!
  author: User! @relation(name: "UserPosts")
}

type Location {
  id: ID! @unique
  lat: Float!
  lng: Float!
  user: User @relation(name: "UserLocation")
}

enum Category {
  TUTORIAL,
  ANNOUNCEMENT,
  NEWS
}

Run prisma deploy to deploy that Prisma service.
Note: It’s very important that your data model is not lacking any type or field that is present in the exported data export.zip. Otherwise, the import might not fully succeed.

Import data into Prisma service

If you followed everything until here, this step is very easy:

prisma import -d export.zip.
Note: You might run into the following problem: https://github.com/graphcool/prisma/issues/2024 We’re already working on a fix here :slightly_smiling_face:

Hope that helps! Let me know if you have any other questions about this process.


Cannot export data from GraphCool
Migrating from Graphcool to Prisma + graphql-yoga