From 5095eb6b2ca20c99bfe4a52202b101414aaead56 Mon Sep 17 00:00:00 2001 From: Richard Mayes Date: Wed, 14 Oct 2020 12:08:47 +0100 Subject: [PATCH] Remove the reference to using async lib --- docs/Getting Started/usage.md | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/docs/Getting Started/usage.md b/docs/Getting Started/usage.md index 720cd78..64003e9 100644 --- a/docs/Getting Started/usage.md +++ b/docs/Getting Started/usage.md @@ -177,29 +177,24 @@ exports.down = function (db) { }; ``` -or use the async library to simplify things a bit, such as: +or use async/await to simplify things quite a bit, such as: ```javascript -var async = require('async'); -exports.up = function (db, callback) { - async.series([ - db.createTable.bind(db, 'pets', { +exports.up = async (db) => { + await db.createTable('pets', { id: { type: 'int', primaryKey: true }, name: 'string' - }), - db.createTable.bind(db, 'owners', { + }); + await db.createTable('owners', { id: { type: 'int', primaryKey: true }, name: 'string' - }) - ], callback); + }); }; -exports.down = function (db, callback) { - async.series([ - db.dropTable.bind(db, 'pets'), - db.dropTable.bind(db, 'owners') - ], callback); +exports.down = async (db) => { + await db.dropTable('pets'); + await db.dropTable('owners'); }; ```