Tasks are defined under the tasks directory. You can create a task at any nesting level and run it with:
yarn task path:to:task --arg1=1 --arg2=2
For instance
yarn task examples:echo --foo=bar --baz=3Should print out the arguments
To create your own task, simply follow the same pattern as ./tasks/examples/echo.js.
Migrations are controlled by a set of 3 tasks
yarn task migrate:new --name my_new_migrationThis task will create a new timestamped file under ./migrations, with the following content
export default {
desc: "Generated migration",
async up() {},
async down() {},
};You'll just have to fill the desc field, as well as the up and down functions. Always keep in mind performance when doing so. If you are performing multiple writes at once, it's a good idea to batch them in a transaction.
yarn task migrate:upIt'll check in the graph DB a Version node and try to run the up methods of the migrations added after said version.
yarn task migrate:downIt'll run the down method of the most recent migration and update the Version node