Add flag to ignore UndefinedReferenceError
chronark opened this issue · 3 comments
I would like to use this tool to add resolvers and other functions after uploading a graphql schema.
Unfortunately this will throw an error because lots of collections etc are not defined in resources
I came accross this little todo and wanted to implement a flag but I am completely lost where to even start. I browsed the code but could not figure out where the flags are actually being used.
The following resource is not defined anywhere in the resource folders
type: Collection, name: accounts
and was referenced from:
type: Index, name: account_by_email
todo: add a boolean to bypass this error in case users
want to reference resources that were defined manually.
The function for checking is being called here but that's as far as I got.
Could you help me figure this out, so I can submit a PR.
Thanks and have a great day
Thanks for the suggestion, when thinking of adding GraphQL support I was thinking along the same lines as one of the options.
I just encountered this while trying to use this tool to manage Roles and Functions and Indexes for my graphql, how is this going?
EDIT 1:
Temporary work-around: use patch-package:
@fauna-labs+fauna-schema-migrate+2.1.5.patch
diff --git a/node_modules/@fauna-labs/fauna-schema-migrate/dist/migrations/plan.js b/node_modules/@fauna-labs/fauna-schema-migrate/dist/migrations/plan.js
index 5f9adb7..c844b5c 100644
--- a/node_modules/@fauna-labs/fauna-schema-migrate/dist/migrations/plan.js
+++ b/node_modules/@fauna-labs/fauna-schema-migrate/dist/migrations/plan.js
@@ -83,7 +83,7 @@ var planMigrations = function (atChildDbPath, extraDbExpr) {
resources[e.type].push(e);
});
// IGNORE for now, illegal references is not something that can easily be verified.
- findIllegalReferences(resources);
+ // findIllegalReferences(resources);
return [4 /*yield*/, from_migration_files_1.getLastMigrationSnippets(atChildDbPath)
// Resources determine how your current data looks.
// Migraitons are generated from resources.
EDIT 2:
I guest this is not the best tool for graphql support currently, because if you are creating an Index using this migration tool, you don't actually create the Collection manually, you put them in the schema.graphql and then it's the one that creates the collection and even the function (then you just have to run update for the function body).
This is in the roadmap for graphql support. Closing this as there is already a ticket for this