https://github.com/nedomas/prisma-nested-export-example
https://github.com/nedomas/prisma-nested-export-example
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nedomas/prisma-nested-export-example
- Owner: Nedomas
- Created: 2018-10-22T18:47:15.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-10-22T18:48:43.000Z (over 6 years ago)
- Last Synced: 2025-02-04T16:25:20.788Z (4 months ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Prisma nested export/import example
Tried to recreate Prisma's export/import losing relations case. Does not happen
with this setup.## Create mock nested records
1. Open http://localhost:4469
2. Create record:
```gql
mutation {
createUser(
data:{
name: "john",
posts: {
create: [
{
name: "post1",
links: {
create: [
{
url: "link1"
}
]
}
}
]
}
}
) {
id
}
}
```## Check that nested relations are there
1. Open http://localhost:4469
2. Query:
```gql
{
users {
id
posts {
id
links {
id
}
}
}
}
```## Export
```
prisma export
```## Clean database before re-import
1. Open http://localhost:4469
2. Clean with multiple mutations in this order:
```gql
mutation {
deleteManyLinks {
count
}
}mutation {
deleteManyPosts {
count
}
}mutation {
deleteManyUsers {
count
}
}
```## Import
```
prisma import --data export-XXX.zip
```In my case, after an import is done - all relations are in place.