You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/indexer/build/graph-migration.md
+8-8Lines changed: 8 additions & 8 deletions
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ Firstly, use the SubQuery CLI tool to migrate an existing SubGraph by using the
42
42
- Intialise a new SubQuery project in your chosen directory for the matching target chain
43
43
- Copy over basic information like project name and other metadata
44
44
- Enable ts strict mode to assist you in identifying potential issues when migrating your project.
45
-
-Copy over the existing `schema.graphql` to save you time (you will need to edit this)
45
+
-Migrate the `schema.graphql` to be compatible with SubQuery, there is a chance you will need to edit this after migration to fine-tune the migrated code.
46
46
- Copy over the existing `project.ts` mapping to save you time (you will need to edit this)
47
47
48
48
An example of using this tool for the Graph Gravatar project is as follows
Once this is done, follow along and complete the remaining steps:
63
63
64
-
1. Review and edit the copied `schema.graphql` and replace any `Bytes` and `BigDecimals`. [More info](#graphql-schema).
65
-
2. Copy over relevant abi contracts to the `abis` directory and update the `project.manifest`. [More info](#manifest-file).
66
-
3. Review and edit the copied data sources in the `project.ts` manifest, specifically the `handlers` (retain the same handler names). [More info](#manifest-file).
67
-
4. Perform code generation using the `yarn codegen`, this will generate GraphQL entity types, and generate types from ABIs. [More info](#codegen).
68
-
5. Copy over the `mappings` directory, and then go through one by one to migrate them across. The key differences:
64
+
1. Review and edit the `schema.graphql`, it will remove any unsupported features and modify relations to work with SubQuery. You may need to change the field parameter in the `@derivedFrom` directive. [More info](#graphql-schema).
65
+
2. Review and edit the copied data sources in the `project.ts` manifest, specifically the `handlers` (we suggest that you retain the same handler names). [More info](#manifest-file).
66
+
3. Perform code generation using the `yarn codegen`, this will generate GraphQL entity types, and generate types from ABIs. [More info](#codegen).
67
+
4. Copy over the `mappings` directory, and then go through one by one to migrate them across. The key differences:
69
68
- Imports will need to be updated
70
69
- Store operations are asynchronous, e.g. `<entityName>.load(id)` should be replaced by `await <entityName>.get(id)` and `<entityName>.save()` to `await <entityName>.save()` (note the `await`).
71
70
- With strict mode, you must construct new entities with all the required properties. You may want to replace `new <entityName>(id)` with `<entityName>.create({ ... })`
72
71
-[More info](#mapping).
73
-
6. Test and update your clients to follow the GraphQL api differences and take advantage of additional features. [More info](#graphql-query-differences)
72
+
5. Test and update your clients to follow the GraphQL api differences and take advantage of additional features. [More info](#graphql-query-differences)
74
73
75
74
### Differences in the GraphQL Schema
76
75
@@ -80,8 +79,9 @@ Visit this [full documentation for `schema.graphql`](./graphql.md). **You can co
80
79
81
80
Notable differences include:
82
81
83
-
- SubQuery does not have support for `Bytes` (use `String` instead) and `BigDecimal` (use `Float` instead).
82
+
- SubQuery does not have support for `Bytes` (use `String` instead), `BigDecimal` (use `Float` instead) and `Timestamp` (use `Date` instead).
84
83
- SubQuery has the additional scalar types of `Float`, `Date`, and `JSON` (see [JSON type](./graphql.md#json-type)).
84
+
- SubQuery does relations slightly differently and the `@derivedFrom` directive is needed in more cases.
85
85
- Comments are added to SubQuery Project GraphQL files using hashes (`#`).
0 commit comments