GraphQL Migrations Filters
It is possible to write custom hooks that can be used to filter out undesirable database operations such as those that could lead to data loss from being executed. The filter is an interface defining a function that takes take the operation and returns true
to execute the operation and false otherwise. By default, GraphQL Migrations does not apply any filter.
For example, if we want to prevent deletion of the tables and columns we can write the following filter to remove table.drop
and column.drop
operations from array:
The removeDeletionOperations
filter can then be used in the migrateDB
method as follows:
GraphQL Migrations has you covered and provides a removeNonSafeOperationsFilter
to avoid doing non safe operations such as table deletion and renaming.